Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Property Value Precedence Question for TextBlock

$
0
0
<Grid><Grid.Resources><Style  TargetType="TextBlock"><Setter Property="FontSize" Value="16"/></Style></Grid.Resources><ListBox FontSize="8"><ListBox.ItemTemplate><DataTemplate><StackPanel><TextBlock Text="TextBlock" /></StackPanel></DataTemplate></ListBox.ItemTemplate><sys:Int32 xmlns:sys="clr-namespace:System;assembly=mscorlib">1</sys:Int32></ListBox></Grid>
I expect the font of the textblock should be 16, instead of 8, because in the dependency property precedence, style setter is higher than property value inheritance. But the result is 8. Would someone please help me to understand this behavior? Thanks in advance.

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>