Click to See Complete Forum and Search --> : property value inheritance


yoyosh
December 7th, 2009, 06:55 AM
It is perfectly fine to write something like that:

<StackPanel TextBlock.FontWeight="Bold">
<Label>dasdas</Label>
<Grid>
<Label>dfasdass</Label>
</Grid>
</StackPanel>

But why it is not possible to set fontweight only for labels by writing Label.FontWeight="Bold" ?

Thank you for help in advance

Arjay
December 7th, 2009, 03:54 PM
But why it is not possible to set fontweight only for labels by writing Label.FontWeight="Bold" ?Post the xaml code for what you have in mind. It's not clear where you would like to set the Label.FontWeight property.

yoyosh
December 11th, 2009, 10:34 AM
Hi,

I would like to set it exactly instead of "TextBlock.FontWeight="Bold"", so to have:

<StackPanel Label.FontWeight="Bold">
<Label>dasdas</Label>
<Grid>
<Label>dfasdass</Label>
</Grid>
</StackPanel>

Arjay
December 11th, 2009, 01:47 PM
Create a style for the Label and set it in there.

yoyosh
December 14th, 2009, 06:28 AM
That`s ok, but why it is not possible with Label while it is possible with TextBlock?

mariocatch
December 15th, 2009, 12:25 PM
TextBlock is a FrameworkElement, Label is a ContentControl.

They are derived from different classes, thus different DependencyProperty's.