Держите узлы постоянно открытыми / закрытыми в RadTreeViewItem - PullRequest
0 голосов
/ 05 июля 2019

У меня есть иерархическое представление дерева, созданное с помощью telerik. Я хотел бы сделать состояние узлов постоянным, то есть, когда дерево закрыто, а затем вновь открыто, узлы должны быть открыты или закрыты, как они были, когда дерево было закрыто. Я знаю, что есть команда getXml (), которая выполняет эту работу, но я не могу использовать ее в своем коде, я изменяю существующее окно. Можете ли вы помочь мне?

Я пытался использовать GetXML (), я также пытался создать свою собственную коллекцию с записанными узлами, она не работала. Это фрагмент RadTreeViewItem из UserControl:

 <Style x:Key="IconStyle" TargetType="{x:Type Image}">
                <Setter Property="Width" Value="16"/>
                <Setter Property="Height" Value="16"/>
                <Setter Property="Margin" Value="0,0,5,0"/>
                <Setter Property="Source" Value="{Binding Source={x:Static Member=fusioncommon:ImageSourceConstants.Project16}}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=IsFolder, Mode=OneWay}" Value="True">
                        <Setter Property="Source" Value="{Binding Source={x:Static Member=fusioncommon:ImageSourceConstants.Folder16}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=IsRingfence, Mode=OneWay}" Value="True">
                        <Setter Property="Source" Value="{Binding Source={x:Static Member=fusioncommon:ImageSourceConstants.RingfenceFolder16}}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="HierarchyTreeViewStyle" TargetType="{x:Type telerik:RadTreeViewItem}">
                <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}"/>
                <Setter Property="Tag" Value="{Binding Path=DataContext, RelativeSource={RelativeSource Mode=FindAncestor, 
                                                       AncestorType={x:Type local:StandardResultSetDocumentView}}, Mode=OneWay}"/>
                <Setter Property="ContextMenu">
                    <Setter.Value>
                        <ContextMenu Visibility="{Binding IsFolder, Converter={StaticResource ResourceKey=BooleanToVisibilityConverter}}">
                            <MenuItem Header="{localization:Resx ResxName=Palantir.CommonResources.ButtonLabels, Key=Expand}"

                              Command="{Binding Path=PlacementTarget.Tag.ExpandAllDescendantFoldersCommand, 
                                                RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}, Mode=OneWay}">
                                <MenuItem.Icon>
                                    <Image Source="{Binding Source={x:Static fusioncommon:ImageSourceConstants.Expand16}}" />
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="{localization:Resx ResxName=Palantir.CommonResources.ButtonLabels, Key=Collapse}"
                                      Command="{Binding Path=PlacementTarget.Tag.CollapseAllDescendantFoldersCommand, 
                                                RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ContextMenu}}, Mode=OneWay}">
                                <MenuItem.Icon>
                                    <Image Source="{Binding Source={x:Static fusioncommon:ImageSourceConstants.Collapse16}}" />
                                </MenuItem.Icon>
                            </MenuItem>
                        </ContextMenu>
                    </Setter.Value>
                </Setter>
             </Style>

Мне нужны узлы в RadTreeViewItem, которые расширяются, чтобы оставаться развернутыми, даже если форма закрыта, поэтому, когда я снова открываю ее, иерархическим представлением является то, что нужно, и это не значение по умолчанию.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...