Intenado usar TreeView

This commit is contained in:
Miguel 2024-06-11 13:29:00 +02:00
parent 759ee627e2
commit 51e70b706f
2 changed files with 9 additions and 11 deletions

View File

@ -204,12 +204,10 @@
</ToolBar> </ToolBar>
</ToolBarTray> </ToolBarTray>
<!-- ListBox --> <TreeView x:Name="TreeViewOs" Grid.Row="1" Margin="5" ItemsSource="{Binding ObjetosSimulables}"
<ListBox x:Name="ListaOs" Grid.Row="1" Margin="5" ItemsSource="{Binding ObjetosSimulables}" SelectedItemChanged="TreeViewOs_SelectedItemChanged">
SelectedItem="{Binding SelectedItemOsList, Mode=TwoWay}" <TreeView.ItemTemplate>
SelectionChanged="ListaOs_SelectionChanged"> <HierarchicalDataTemplate ItemsSource="{Binding Clones}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Nombre}"> <TextBlock Text="{Binding Nombre}">
<TextBlock.Style> <TextBlock.Style>
<Style TargetType="TextBlock"> <Style TargetType="TextBlock">
@ -224,9 +222,9 @@
</Style> </Style>
</TextBlock.Style> </TextBlock.Style>
</TextBlock> </TextBlock>
</DataTemplate> </HierarchicalDataTemplate>
</ListBox.ItemTemplate> </TreeView.ItemTemplate>
</ListBox> </TreeView>
<!-- GridSplitter --> <!-- GridSplitter -->
<GridSplitter Grid.Row="2" Height="5" HorizontalAlignment="Stretch" Background="Gray" <GridSplitter Grid.Row="2" Height="5" HorizontalAlignment="Stretch" Background="Gray"

View File

@ -460,12 +460,12 @@ namespace CtrEditor
tt.Y = relativeY - cursorPosition.Y * st.ScaleY; tt.Y = relativeY - cursorPosition.Y * st.ScaleY;
} }
private void ListaOs_SelectionChanged(object sender, SelectionChangedEventArgs e) private void TreeViewOs_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{ {
//PanelEdicion.Children.Clear(); // Limpiar el panel existente //PanelEdicion.Children.Clear(); // Limpiar el panel existente
UserControlFactory.LimpiarPropiedadesosDatos(PanelEdicion); UserControlFactory.LimpiarPropiedadesosDatos(PanelEdicion);
if (e.AddedItems.Count > 0 && e.AddedItems[0] is osBase selectedObject) if (e.NewValue != null && e.NewValue is osBase selectedObject)
CargarPropiedadesosDatos(selectedObject); CargarPropiedadesosDatos(selectedObject);
} }