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>
</ToolBarTray>
<!-- ListBox -->
<ListBox x:Name="ListaOs" Grid.Row="1" Margin="5" ItemsSource="{Binding ObjetosSimulables}"
SelectedItem="{Binding SelectedItemOsList, Mode=TwoWay}"
SelectionChanged="ListaOs_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<TreeView x:Name="TreeViewOs" Grid.Row="1" Margin="5" ItemsSource="{Binding ObjetosSimulables}"
SelectedItemChanged="TreeViewOs_SelectedItemChanged">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Clones}">
<TextBlock Text="{Binding Nombre}">
<TextBlock.Style>
<Style TargetType="TextBlock">
@ -224,9 +222,9 @@
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<!-- GridSplitter -->
<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;
}
private void ListaOs_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void TreeViewOs_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
//PanelEdicion.Children.Clear(); // Limpiar el panel existente
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);
}