|
That's the first thing I did - it appeared as expected - but I refused to believe it
|
|
|
|
|
Hi,
I am facing problem with using .XAP file in ASP.Net Website. I have written the following code to use .XAP in .Aspx page
<form id="form1" runat="server">
<div style="height:100%; background-color:#282828;" align="right">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="1%"></td>
</tr>
<tr>
<td width="1%">
<div style="height:100%; background-color:#282828;" align="right">--%>
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/SilverlightApplication.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />
</div>
</td>
</tr>
<table>
If i write like that is only assigned to particular row but i want it for whole page. If I write <asp:silverlight> control after form tag then the silverlight content is assigned above the table and the table data seperated from silverlight content.
Please see the below link to drag and drop videos but that drag and drop videos is not working outside that row only within that row.
http://219.91.199.132/silverl/home.aspx
Can you please guide me how to user .XAP file to whole aspx page.
Thanks in Advance
Pavani
|
|
|
|
|
pavanip wrote: Can you please guide me how to user .XAP file to whole aspx page.
Do you want the Silverlight plugin to take up the entire browser window or
a cell in an HTML table?
Regardless, this isn't really a Silverlight question - you may get better response
on the Web Development board for HTML questions.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
Are there any code sample for playing a rtsp or udp stream. I have live555 rtsp streaming server setup in my pc and like to play the stream using a wpf code sample using vs2008.
Will this support. How can I do this.
Please help
|
|
|
|
|
Hi,
I use adorners to move elements in a canvas but I want that those elements stay in the canvas bounderies. So when I drag an element over one of the bounderies, it should stay against that boundery and not cross it.
Now I only check the top and left bounderies with the Canvas.GetLeft and Canvas.GetTop. The width and height of the canvas is variable. Anybody has an idea how I can prevent the elements to cross the right and bottom bounderies?
Thx
|
|
|
|
|
Have you tried ClipToBounds[^] ?
How are you implementing the drag/drop ?
|
|
|
|
|
I hadn't tried it before but ClipToBounds doesn't work.
When I add a new UIElement (like an image) to the Canvas, I adorn it. That adorner adds a Thumb to each side of the UIElement and that thumbs handles the drag function.
private void HandleMove(object sender, DragDeltaEventArgs args)
{
if (StanagCanvas.GetLeft(this.AdornedElement) + args.HorizontalChange < 0)
{
StanagCanvas.SetLeft(this.AdornedElement, 0);
}
else if (StanagCanvas.GetRight(this.AdornedElement) - args.HorizontalChange < 0)
{
StanagCanvas.SetRight(this.AdornedElement, 0);
}
else
{
StanagCanvas.SetLeft(this.AdornedElement, StanagCanvas.GetLeft(this.AdornedElement) + args.HorizontalChange);
}
if (StanagCanvas.GetTop(this.AdornedElement) + args.VerticalChange < 0)
{
StanagCanvas.SetTop(this.AdornedElement, 0);
}
else if (StanagCanvas.GetBottom(this.AdornedElement) - args.VerticalChange < 0)
{
StanagCanvas.SetBottom(this.AdornedElement, 0);
}
else
{
StanagCanvas.SetTop(this.AdornedElement, StanagCanvas.GetTop(this.AdornedElement) + args.VerticalChange);
}
}
(StanagCanvas derives from Canvas)
Offcourse the Right and Bottom properties don't work because I allready use the Left and Top properties. The element doesn't cross the left and top boundery of the canvas.
I hope this is enough information.
|
|
|
|
|
You could do it without the Right/Top properties. Something like,
else if ( (StanagCanvas.GetLeft(this.AdornedElement) + this.AdornedElement.Width + args.HorizontalChange) > yourCanvas.Width )
{
StanagCanvas.SetLeft(this.AdornedElement, yourCanvas.Width - this.AdornedElement.Width);
}
|
|
|
|
|
I tried that already. The problem with that is that I don't have a reference to the canvas so I can't get the width of it. Or am I totally wrong (It is weekend now for me so I can't recheck it but in a few days my mind is clear again and I can get a fresh start)
That adorner class (derives from Adorner like you know) is separated from my canvas class. I only call it when initializing a new UIElement on the canvas to adorn that element (and it stays adorned until I close the program or the UIElement is deleted). I guess that after I have added the adorner, that adorner only knows his element (this.AdornedElement) and nothing else. The actions I take from then with that adorner, can only affect Attached Properties (Like SetLeft, ... + I have made some extra attached properties in my Canvas class).
I can be totally wrong. If you want to know, I'm only programming for a few months without a proper eduction for it (I had programming on school but only basics). I'm learning it all myself (C# and WPF) and I need to make program for a company where I'm kind of an intern (1 year internship in a foreign country after getting my degree to get some experience before going to work in my own country).
Hope you can say that I'm wrong and it is that simple (but I missed something)
|
|
|
|
|
Pauwels Bart wrote: private void HandleMove(object sender, DragDeltaEventArgs args)
Who is the sender ? Is it the element in canvas ? If yes, you can do something like this,
FrameworkElement parent = ((sender as FrameworkElement).Parent as FrameworkElement;
EDIT: forgot to mention, you can then get the Width parent.Width
modified on Thursday, April 2, 2009 2:15 PM
|
|
|
|
|
That looks like a good answer
I have tried to call the parent with the sender but that didn't work. That was probably because I didn't parse it as a FrameworkElement or something like that.
I wouldn't know what to do if this site and forum didn't exists. Thx very much for the help.
I will try it and let you know if it worked!
|
|
|
|
|
Ok, the sender was not the element in the canvas but the thumb. Luckely I can get the element with "this.AdornedElement" (standard build-in adorner function to get the adorned element).
So, the solution was:
private void HandleMove(object sender, DragDeltaEventArgs args)
{
FrameworkElement element = this.AdornedElement as FrameworkElement;
StanagCanvas stanagCanvas = element.Parent as StanagCanvas;
if (StanagCanvas.GetLeft(element) + args.HorizontalChange < 0)
{
StanagCanvas.SetLeft(element, 0);
}
else if (StanagCanvas.GetLeft(element) + element.Width + args.HorizontalChange > stanagCanvas.Width)
{
StanagCanvas.SetLeft(element, stanagCanvas.Width - element.Width);
}
else
{
StanagCanvas.SetLeft(element, StanagCanvas.GetLeft(element) + args.HorizontalChange);
}
if (StanagCanvas.GetTop(element) + args.VerticalChange < 0)
{
StanagCanvas.SetTop(element, 0);
}
else if (StanagCanvas.GetTop(element) + element.Height + args.VerticalChange > stanagCanvas.Height)
{
StanagCanvas.SetBottom(element, stanagCanvas.Height - element.Height);
}
else
{
StanagCanvas.SetTop(element, StanagCanvas.GetTop(element) + args.VerticalChange);
}
}
I just made it to difficult and overlooked this simple sollution! Now the element stays within the bounderies of the canvas.
thx ABitSmart
|
|
|
|
|
That's great
Looking at your code, when it crosses the bottom boundary, you are setting the Bottom. Shouldn't it be SetTop ?
|
|
|
|
|
How could I have missed that!
|
|
|
|
|
Any insight for a small civil engineering program.
It will have 4 forms(excluding open/close dialog boxes) and will run in C#:
Main - menubar, tabstrip, Datagrid and a couple buttons
Chart Form - Graphics form to display a generated flow chart
Project form - basically a glorified dialog box for project info
Report Form - basically just a .doc file holder
If I go the WPF route I would like to produce my own style (kinda like Vista but not so heavy).
I don't have much experience with WPF besides tutorials and articles and I just want some personal experiences to help me make an informed decision.
|
|
|
|
|
This is a fairly straightforward application, and shouldn't present you with too much trouble. If you adopt MVVM as your main design pattern, you'll find that it's easy to debug and test because you'll test your business logic in isolation from the way that it's presented.
You'll find it easier to code up a flow chart in WPF than you would in WinForms - so much of the graphics subsystem has been designed to make it easier to use (once you have experience). I would state though, that if you have experience in WinForms and none in WPF then you've got a steep learning curve ahead of you, and I'd get my feet wet on a couple of small applications first before tackling this one, so you might be better off using WinForms if that's what you're used to. If you don't have extensive experience in WinForms, I'd definitely recommend taking the plunge into WPF. Actually, I'd recommend it anyway, but I am a WPF nut.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
If you have swear jar in your office go with WinForms - otherwise WPF is worth a go but be prepared to climb a mountain
|
|
|
|
|
Thank for the responses. Ive been messing around with WPF and I feel its the way I'm going to go. I just don't like stepping into aging standards. WPF is is! I'm sure I'll be back with plenty of questions. Thanks.
|
|
|
|
|
I have abutton control, there are some style properties which can be set in App.xaml like this
Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="20"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Foreground" Value="Red"/>
</Style>
and give in button control as
Style="{StaticResource ButtonStyle}"
or in xaml.cs file as
btnTest.Style = (Style)(Application.Current.Resources["ButtonStyle"]);
But I want to generate this style dynamically and save it in a string and extract the style object from that string and apply it to the Button control.
In other words I want to take style from a string not from App.xaml.
Is it possible in Silverlight 2.0?
Thanks in advance,
|
|
|
|
|
|
I don't want to load the entire xaml file and store it.
I want this file data inside a string for example:
string s="<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="20"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Foreground" Value="Red"/>
</Style>";
and apply that like:
btnTest.Style = (Style)(SOMETHING["ButtonStyle"]);
What will be that SOMETHING...?
How can I apply that ButtonStyle from the string s?
|
|
|
|
|
salon wrote: I don't want to load the entire xaml file and store it.
Right. I stated the article may have the info you need.
You need a Style object from the XAML. That means the XAML has to be parsed - see the article.
What are you trying to achieve that wouldn't be simpler with a few lines of code
to create a Style dynamically?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi friends
I am using sliverlight2 toolkit but it give the Error at loading time
Error:-Sys.InvalidOprationException.ManageRunTimeError error #4004 in control 'Xaml1'............................
Thanks
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Problem in Control(Combobox) just delete the Item of The comboBox.........................
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Hi,
I have a listview as below:
<br />
<Window x:Class="Practice.WPF.ListViewTest"<br />
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br />
Title="ListViewTest" Height="300" Width="75" Closed="Window_Closed"><br />
<br />
<ListView x:Name="listView" ScrollViewer.IsDeferredScrollingEnabled="True" VirtualizingStackPanel.IsVirtualizing="True"><br />
<ListView.View ><br />
<GridView ><br />
<GridViewColumn Header="Id" DisplayMemberBinding="{Binding Path=Id}"></GridViewColumn><br />
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"></GridViewColumn><br />
<GridViewColumn Header="Price" DisplayMemberBinding="{Binding Path=Price}"></GridViewColumn><br />
<GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=Date}"><br />
</GridViewColumn><br />
<GridViewColumn Header="Quantity" DisplayMemberBinding="{Binding Path=Quantity}"></GridViewColumn><br />
</GridView><br />
</ListView.View><br />
</ListView><br />
</Grid><br />
</Window><br />
The problem is when there is no data bound to the listview the horizontal scrollbar disappears, and the Headers get cut off. I want the horizontal scrollbar to be still visible.
(My requirement may sound weird, but i want this functionality for a listview which displays streaming numerical data and has filters on column headers. Sometimes the filter condition does not satisfy any of the rows so the listview becomes empty and horizontal scrollbar disappears. Now some of the columns will get cut off and the user cannot scroll to that column and clear the filter.)
ANy ideas how i achieve this.
Pankaj Chamria,
Software Programmer.
|
|
|
|