TreeView Style

Sep 12, 2013 at 5:17 PM
Hi,

on question to treeview style. I develop a application based on this wonderful framework and build on customcontrol with a treeview like this
<TreeView ItemsSource="{Binding Items}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
                    <TreeView.ItemContainerStyle>
                        <Style TargetType="{x:Type TreeViewItem}">
                            <Setter Property="IsExpanded" Value="{Binding ItemModel.IsExpanded, Mode=TwoWay}" />
                            <Setter Property="IsSelected" Value="{Binding ItemModel.IsSelected, Mode=TwoWay}" />
                            <Setter Property="FontWeight" Value="Normal" />
                            <Style.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="FontWeight" Value="Bold" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </TreeView.ItemContainerStyle>
                    <TreeView.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding Children}">
                            <TextBlock Text="{Binding ItemModel.Text}" />
                        </HierarchicalDataTemplate>
                    </TreeView.ItemTemplate>
                </TreeView>
If I changed the style via appearance page to dark or to small font size nothing happens. In the ui example it works well (dark background, white tree nodes). Any idea?

Thanks in advanced
Sep 17, 2013 at 4:31 PM
because the ItemContainerStyle override the mui default style!
and you doesn't set the template property,so it come to find the system treeitem style!
you can fix this by this code:
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">

BTW,i think the fontsize will change,but the small and the large fontsize isn't very difference.so you can't identified it.