Files
aistudio-wpf-diagram/Others/Dragablz/DragablzDemo/LayoutManagementExample.xaml
2023-04-16 20:11:40 +08:00

50 lines
2.6 KiB
XML

<UserControl x:Class="DragablzDemo.LayoutManagementExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dragablzDemo="clr-namespace:DragablzDemo"
xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
d:DataContext="{d:DesignInstance dragablzDemo:LayoutManagementExampleViewModel, IsDesignTimeCreatable=False}">
<UserControl.Resources>
<DataTemplate DataType="{x:Type dragablzDemo:TabablzControlProxy}">
<StackPanel Orientation="Horizontal">
<TextBlock>TabablzControl. Operations:</TextBlock>
<Button Command="{Binding SplitHorizontallyCommand}">Split Horizontally</Button>
<Button Command="{Binding SplitVerticallyCommand}">Split Vertically</Button>
<TextBlock>Ratio:</TextBlock>
<Slider Value="{Binding SplitRatio}" Width="160" />
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button Command="{Binding QueryLayoutsCommand}">Query Layouts</Button>
<TreeView Grid.Row="1" ItemsSource="{Binding RootNodes}" x:Name="TreeView">
<TreeView.Resources>
<DataTemplate DataType="{x:Type dragablzDemo:TabablzControlProxy}">
<TextBlock>TabablzControl</TextBlock>
</DataTemplate>
</TreeView.Resources>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type dragablzDemo:TreeNode}"
ItemsSource="{Binding Children}">
<ContentControl Content="{Binding Content}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<ContentControl Grid.Row="2" Content="{Binding ElementName=TreeView, Path=SelectedItem.Content}" />
</Grid>
</UserControl>