Hello
I'm new in XAML but I have some C# experience. I thought lets dive into XAML as it looks nice and (I thought is worth the afford). But I start to think that this is way to complicated.
In WPF I could select a textbox change labels easy with something like 'label1.forecolor'.
Yesterday I just wanted to change the foreground color of a ListViewItem
and this is 5 lines of code.
Now I want to change a Textbox header
forecolor and I can search what I want on Google or MSDN but I do not find any example that makes sense to me or works. (probably my lack of understanding). But one thing is for sure I do not see the logic of how these properties work. I would assume that it should be pretty straight forward.
First the code that was suggested (and is working perfect) for a ListViewItem
<ListView Grid.Row="1" Background="LightGray">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Foreground" Value="Black" />
</Style>
</ListView.ItemContainerStyle>
<ListViewItem>Thomas</ListViewItem>
<ListViewItem>Julia</ListViewItem>
<ListViewItem >Anna</ListViewItem>
<ListViewItem>Anna</ListViewItem>
<ListViewItem>Anna</ListViewItem>
<ListViewItem>Anna</ListViewItem>
<ListViewItem>Anna</ListViewItem>
<ListViewItem>Anna</ListViewItem>
<ListViewItem>Anna</ListViewItem>
<ListViewItem>Alicia</ListViewItem>
</ListView>
Next I found on MSDN that (if I understand it correctly) I should use the property `TextControlHeaderForeground'
One of the things I have tried is as below (and is not working)
<StackPanel Grid.Row="1" Grid.Column="1" Background="LightGray" >
<TextBox
x:Name="TextBox1"
Header="Firstname"
Margin="10"
TextControlHeaderForeground ="Blue"
/>
<TextBox Header="Lastname" Margin="10"/>
<CheckBox x:Name="isDeveloper" Content="Is developer" Margin="10" Foreground="#FF131010">
<CheckBox.Background>
lightgray
</CheckBox.Background>
</CheckBox>
</StackPanel>
And I haven't even started to try to change the Foreground of the Checkbox LOL. I trully beleive that XAML have some logic behind all this but I can't see it at the moment. Does someone want to help me out a bit?
Thanks a lot