Arrange controls inside a user control in wpf
-
Hi Experts, I have a user control. I am dynamically adding controls to this user control using
Children.Add
. I want to change their location on some event in code. Like we can do in winform using Location. Is there anything similar to this? Please help! Thanks in advance! Regards, Samar -
Hi Experts, I have a user control. I am dynamically adding controls to this user control using
Children.Add
. I want to change their location on some event in code. Like we can do in winform using Location. Is there anything similar to this? Please help! Thanks in advance! Regards, SamarYou could always set the Margin of the control to move/size it. Without knowing what exactly you are trying to achieve, it's hard to add any more detail.
"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.
-
You could always set the Margin of the control to move/size it. Without knowing what exactly you are trying to achieve, it's hard to add any more detail.
"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.
Hi, I think i was a little too generic in explaining my problem. I will give my current scenario. I am trying to build an MDI in WPF. As you know there is no concept of MDI in WPF but i got a simulated MDI code from codeplex. The link for the same is given here. Now i want to tile the child controls in the mdi either horizontally, vertically or cascade in the way similar to windows MDI like
this.LayoutMdi(MdiLayout.TileHorizontal);
. Please help! Thanks in advance. Regards, Samar -
Hi, I think i was a little too generic in explaining my problem. I will give my current scenario. I am trying to build an MDI in WPF. As you know there is no concept of MDI in WPF but i got a simulated MDI code from codeplex. The link for the same is given here. Now i want to tile the child controls in the mdi either horizontally, vertically or cascade in the way similar to windows MDI like
this.LayoutMdi(MdiLayout.TileHorizontal);
. Please help! Thanks in advance. Regards, SamarDid you mean something like this? [code]
[/code] Try to copy and paste this in a blanc scene, it that what you want then you can also do this in code behind [code]Rectangle rect = new Rectangle { Width = 50, Height = 50, Fill = new SolidColorBrush(Colors.Blue) }; Canvas.SetLeft(rect, 50); Canvas.SetTop(rect,50); [/code]
-
Did you mean something like this? [code]
[/code] Try to copy and paste this in a blanc scene, it that what you want then you can also do this in code behind [code]Rectangle rect = new Rectangle { Width = 50, Height = 50, Fill = new SolidColorBrush(Colors.Blue) }; Canvas.SetLeft(rect, 50); Canvas.SetTop(rect,50); [/code]
Yeah something on the similar lines. I got the solution as.
uc1.SetValue(Canvas.TopProperty, Convert.ToDouble(12)); uc1.SetValue(Canvas.LeftProperty, Convert.ToDouble(12));
The above will move the usercontrol uc1 12 from the top and 12 from the left. Thanks. :) Regards, Samar