Reputation: 25651
I have a WPF expander control which is not rendering the expander header content when the app is run on XP machine (XP with SP3), when run on a Win7 machine the content is rendered as expected.
The expander header is a virtualised stack panel (horizontal) with a couple of text blocks inside.
When I use snoop to investigate I can see the expected text and the font colour is black - so it's not white text on a white background.
Anyone know why it would not be rendering on XP?
Header template:
<Expander.Header>
<VirtualizingStackPanel Orientation="Horizontal">
<Controls2:HighlightTextBlock Style="{StaticResource RegularTextStyle}"
Text="{Binding Name, Mode=OneWay}"
Margin="10,0,0,0"
HighlightText="{Binding RelativeSource=RelativeSource FindAncestor, AncestorType={x:Type Controls2:ViewHost}}, Path=DataContext.SearchText}"
Foreground="{StaticResource Jedi.HighlightForegroundTextBrush}"
HighlightBackground="{StaticResource Jedi.HighlightBackgroundTextBrush}"/>
<TextBlock Margin="15,0,0,0">
<Run Text="(" />
<Run Text="{Binding Id, Mode=OneWay}"></Run>
<Run Text=")"/>
</TextBlock>
</VirtualizingStackPanel>
</Expander.Header>
Upvotes: 1
Views: 255
Reputation: 31202
You should replace the VirtualizingStackPanel by a StackPanel.
According to MSDN :
The word "virtualize" refers to a technique by which a subset of user interface (UI) elements are generated from a larger number of data items based on which items are visible on-screen. Generating many UI elements when only a few elements might be on the screen can adversely affect the performance of your application. The VirtualizingStackPanel calculates the number of visible items and works with the ItemContainerGenerator from an ItemsControl (such as ListBox or ListView) to create UI elements only for visible items.
So in this case, as there are few items inside your panel, it is not needed.
Upvotes: 1