Answer the question
In order to leave comments, you need to log in
How are XAML object property values set?
Good evening.
I just can't understand how the properties of objects are set, for example, Foreground or Margin?
Code example:
public MainPage()
{
this.InitializeComponent();
TextBlock story = new TextBlock();
story.Text = "TestTestTest";
story.FontSize = 22;
story.Margin = "???";
story.Foreground = "???";
body.Children.Add(story);
}
textBlock.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
или
textBlock.Foreground = Brushes.Blue;
Answer the question
In order to leave comments, you need to log in
story.Margin = new Thickness(0,5,0,5);
story.Foreground = new SolidColorBrush(Colors.LimeGreen);
What mistake? namespace not added or what?
All 3 methods mentioned in this thread work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question