Saturday, October 6, 2012

Set the UserControl and Grid Height and Width using c#

Set the UserControl and Grid Height and Width using c#

Hi Experts,

Can you suggests me how will I increase and decrese the DesignHeight and DesignWidth of a UserControl using c#.

and also the Grid Height and Width.

Thanks in advance

Answers & Comments...

Answer: 1

Hi BuntyBubly,

The d: attributes are used by the designer and are ignored by the runtime. It makes no sense to increase or decrease in codebehind. You can change the Grid's height and width in its Loaded method.

<Grid x:Name="LayoutRoot" Background="Blue" Width="90" Height="90" Loaded="LayoutRoot_Loaded">        </Grid>   private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)          {              LayoutRoot.Height = 200;              LayoutRoot.Width = 300;          }  

Best Regards,





No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog