|
Indeed
But unfortunately I do not have a simple trigger to decide, and if I have to handle converters, I prefer to make everything in code.
|
|
|
|
|
So simple...
Just set object.Style = null;
Thanks all!
|
|
|
|
|
I'am trying to develop an asp.net website using silverlight but i've tried to install silverlight but it says i need pre requisites please point me to the correct direction
|
|
|
|
|
All that you need to download is linked to from this page[^].
"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
|
|
|
|
|
You need to have .NET 3.5 service pack 1 and Visual Studio 2008 service pack 1 before installing Silverlight Tool for Visual Studio.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Hi,
I am working on a silverlight application. In this I need to place usercontrols on a canvas in the Page.xaml page dynamically at run time. Later I need to set the data values for the datagrid on these user controls from the Page.xaml itself. I want to set different data for different user controls.
How can i differentiate these user controls from one another and set differnt data to their datagrid from Page.xaml itself.
please reply me if u have any idea to solve this.
Thanks in advance
|
|
|
|
|
There are a couple of ways to do this; it just depends on whether or not you are using pure databinding and MVVM. If you are using MVVM and pure databinding, then there's very little that you need to do because the View/ViewModel integration will take care of the hard work for you. If you aren't, then you can assign a name to each control when you assign it using the x:Name property, e.g. x:Name="myUserControl1" (this is if you add it into the XAML). If you add it using code behind, you just assign the name to the Name property.
"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
|
|
|
|
|
Either you are instantiating the objects yourself, and can take them with x:Name and have your own reference, or you are using them in a template in the DataGrid. If you are using them in a template, you can hook into the <coded>Loaded event and do something with them. For example, you might do this:
<DataGrid>...<u:MyControl Loaded="MyControl_Loaded".../>...</DataGrid>
In the MyControl_Loaded you can then take the event arguments and do something with the control, either processing, passing it into a controller, etc.
|
|
|
|
|
I have a pretty basic question to which I want a solution.
I have a bunch of controls on a WPF form. Some controls are within a Grid. I want these controls to stay centered within the grid when maximizing and resizing the window, but as soon as I maximize my window the controls get thrown out of position. I know this probably has someting to do with the Margin property of the controls. Can someone just please tell me how to set the margin or any other property so that the controls stay where I want them too
Thanks in advance
|
|
|
|
|
Etienne_123 wrote: Some controls are within a Grid. I want these controls to stay centered within the grid when maximizing and resizing the window
What is the parent of the grid with the controls? The parent may
be affecting the layout.
Here's an example of a grid with controls that stays centered in a window:
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Content="button1" Grid.Column="0" Grid.Row="0" />
<Button Content="button2" Grid.Column="1" Grid.Row="1" />
</Grid>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The parent control is a Groupbox
|
|
|
|
|
Etienne_123 wrote: The parent control is a Groupbox
Ok....and how is this groupbox supposed to behave when the window
is resized?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Etienne_123 wrote: The parent control is a Groupbox
Then you should give more details, as a groupbox can have only one child.
You can't turn lead into gold, unless you've built yourself a nuclear plant.
|
|
|
|
|
If you don't want your controls to change size or position, you have to anchor them to *just* the left and top sides of the parent control.
Be aware that if you change the control's position in the designer (as opposed to changing it in the XAML), the designer will make assumptions based on some weird-ass algorithm and will CHANGE the anchors for you. You then have to go back and change them back to what you actually wanted. I've heard that they fixed this behavior in VS2010, but I'm not sure because they claimed they fixed other stuff in 2010, and it *that other stuff) sure as hell ain't fixed.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
"Real" WPF coders use notepad to type XAML!
You can't turn lead into gold, unless you've built yourself a nuclear plant.
|
|
|
|
|
Notepad is for wimps.
Only little girls need a GUI.
I use "edit" "edlin" from a command prompt.
Mark Salsbery
Microsoft MVP - Visual C++
modified on Saturday, August 15, 2009 12:45 PM
|
|
|
|
|
ROTFL!
You can't turn lead into gold, unless you've built yourself a nuclear plant.
|
|
|
|
|
Hi,
I have a canvas and i am adding dynamic textbox controls to the canvas when the page is loaded. When i was trying to add event handlers (say mousedown event on textbox), the event is not firing when i mousedown on textbox after the page loaded.
I am providing sample code:
I have declared one global textbox name 'tb'.
This is my canvas control:
<Canvas x:Name="CustomizeTools" Grid.Row="1" Height="400" Width="800" Grid.Column="0" Background="Aqua">
</Canvas>
In code behind my logic is like this:
tb = new Textbox();
tb.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(tb_MouseLeftButtonDown);
CustomizeTools.Children.Add(tb);
void tb_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
}
But here the mouse events are not firing.
pleae help me. Its urgent.
Thanks in advance
modified on Tuesday, August 11, 2009 6:22 AM
|
|
|
|
|
The textbox has default behaviours in place for handling the mouse events - what you need to do is handle the PreviewMouseLeftButtonDown event instead. This gets to your handler before the textbox consumes the MouseLeftButtonDown event. It's a simple fix:
tb.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(tb_MouseLeftButtonDown); Alternitively, you can add your own handler using
tb.AddHandler(UIElement.MouseLeftButtonDownEvent, new RoutedEventHandler(tb_MouseLeftButtonDown),true);
"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
|
|
|
|
|
Hi,
Can any 1 guide me through how to host an silverlight appl on local IIS ver 5.1. I tried hosting it, the problem is that the web services dosnt work, i dont know if i have hosted the appl properly or not, i have followed same steps as per a ASP.Net appl hosting.
Thanks in advance
|
|
|
|
|
This isn't a Silverlight question. There's no hosting issues related to
Silverlight beyond delivering the Silverlight specific MIME type(s).
You may want to try the WCF/WPF or ASP.NET board, whatever's
more appropriate.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Anyways thanks, i got solution to my prob.
|
|
|
|
|
|
Please modify your post - you've provided what looks like real data in there, and this will probably upset the people who are paying you for this system.
More importantly though - why are you saving the controls out? Surely you only need to save the underlying data - aren't the controls static?
"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
|
|
|
|
|
Oh, sorry. I am sorry about the real data.
Coming to your question about saving the controls, its my project requiremnt to save the controls also.
Regards ,
Veerendra
|
|
|
|