Pregunta

Editar: Ahora parece que este es un error con los controles Telerik que estoy usando. Después de volver a implementar mi XAML usando .NET TreeView, obtengo los resultados que esperaría. Le informé esto a Telerik y responderé esta publicación después de recibir noticias de ellos.

Estoy intentando (con un éxito limitado) crear una vista de árbol que contenga una mezcla de datos dinámicos y estáticos.

Encontrará mi mejor intento actual en esto a continuación, sin embargo, ya que anido las vistas de los árboles, hay un efecto secundario en el que es posible tener múltiples elementos dentro de la vista de árbol principal seleccionada. Cuando intenté anidar TreeViewitems, los resultados no fueron positivos, es decir, solo se muestra el nivel de nivel de nivel principal en el itemtemplate y se crea espacio para sus hijos, pero no se produce nada.

Realmente me gustaría saber cómo lograr mi objetivo sin recurrir a especificar todo el menú en colecciones que encuentro a TreeView.

Gracias

<telerik:RadTreeView Width="225" HorizontalAlignment="Left" Background="Transparent" FontWeight="SemiBold">
        <telerik:RadTreeViewItem Header="Customer" Command="{Binding OpenCustomerCommand}"/>
        <telerik:RadTreeViewItem Header="Sites" Command="{Binding OpenSiteBrowserCommand}" ItemsSource="{Binding Sites}">

            <telerik:RadTreeViewItem.ItemTemplate>
                <DataTemplate>

                    <telerik:RadTreeView>

                        <telerik:RadTreeViewItem Header="{Binding Key}"
                            Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                            Path=DataContext.OpenSiteCommand}" 
                            CommandParameter="{Binding Value}">

                            <telerik:RadTreeViewItem Header="Material Profiles" 
                                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                                Path=DataContext.OpenMaterialProfileBrowserCommand}" 
                                CommandParameter="{Binding Value}"/>

                            <telerik:RadTreeViewItem Header="Prices" 
                                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                                Path=DataContext.OpenPriceBrowserCommand}" 
                                CommandParameter="{Binding Value}"/>

                            <telerik:RadTreeViewItem Header="Orders"
                                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                                Path=DataContext.OpenOrderBrowserCommand}" 
                                CommandParameter="{Binding Value}"/>

                            <telerik:RadTreeViewItem Header="Activity">

                                <telerik:RadTreeViewItem Header="Collection"
                                    Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                                    Path=DataContext.OpenActivityCollectionsBrowserCommand}" 
                                    CommandParameter="{Binding Value}"/>

                                <telerik:RadTreeViewItem Header="Call Outs"
                                    Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                                    Path=DataContext.OpenActivityCallOutBrowserCommand}" 
                                    CommandParameter="{Binding Value}"/>

                                <telerik:RadTreeViewItem Header="Gate"
                                    Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                                    Path=DataContext.OpenActivityGateBrowserCommand}" 
                                    CommandParameter="{Binding Value}"/>

                                <telerik:RadTreeViewItem Header="One Off Charges"
                                    Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:WindowViewBase}, 
                                    Path=DataContext.OpenActivityOneOffChargeBrowserCommand}" 
                                    CommandParameter="{Binding Value}"/>

                            </telerik:RadTreeViewItem>

                        </telerik:RadTreeViewItem>
                    </telerik:RadTreeView>
                </DataTemplate>
            </telerik:RadTreeViewItem.ItemTemplate>

        </telerik:RadTreeViewItem>
¿Fue útil?

Solución

Telerik ha confirmado que esto no es posible con su control Radtreeview y lo han agregado a su lista de TODO.

Gracias por los comentarios de todos modos.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top