Adding a WPF control into a panel programmatically
The best way to design an interface for WPF is using xaml. However, in some situation, we need to change the layout in code. For example, we select a category view, we need to add a new block in a stack panel.
For example:
Code
TextBlock text1 = new TextBlock(); | |
text1.Text = grid.HeaderText; | |
LinearGradientBrush style = this.FindResource("LeftHeaderBrush") as LinearGradientBrush ; | |
text1.Background= style; | |
text1.Height = 100; | |
inactivePanels.Children.Add(text1); |
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 32 feedbacks awaiting moderation...
Form is loading...