0

グリッドに動的な数の要素があり、視覚化にテンプレートを使用しています。

<UserControl x:Class="MUSTANG.GUI.TableModule.Controls.ColumnAxis"
         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" 
         mc:Ignorable="d" >
    <UserControl.Resources>
        <Style  TargetType="ListViewItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListViewItem">

                        <!-- Here will be the layout of the elements from the ListView -->

                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="ListView">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=TreeItemChildren.Count}" Value="0">
                    <Setter Property="Visibility" Value="Collapsed"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>

    <ListView ItemsSource="{Binding Path=RootItem.TreeItemChildren}" Padding="{Binding Path=RootItem.PaddingFixWindows6}">
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <!-- Somewhere here should be a GridSplitter -->
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">

                </StackPanel>
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>
    </ListView>
</UserControl>

ここで、ListView の各項目に GridSplitter を使用したいと考えています。ItemsPanelTemplate は 1 つの VisualTree しか想定していないため、私が試したものはすべて機能しません (そのため、StackPanel の下に Gridsplitter を配置することはできません)。

これを別の方法で行う可能性はありますか?おそらくコードビハインドファイルからですか?動的な数の要素があり、それらの間である種のスプリッターを使用したいという主な問題を解決する必要があります。

背景情報: 再帰呼び出しのため、テンプレートを使用する必要があります。元のコードでは、最初のグリッドの後に別の ListView があります。

4

0 に答える 0