0

我必须使用模板在 WPF 中创建一个 ListBox,该模板填充整个表单。但是在表单的中间(在列表框内),我必须水平显示另一个列表框,有人可以帮助我吗:

4

1 回答 1

0

像这样的东西应该工作

<Window.Resources>
        <DataTemplate x:Name="anotherItemTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding anotherLabel}"></TextBlock>
            </StackPanel>

        </DataTemplate>

        <DataTemplate x:Key="itemTemplate">
            <StackPanel>
                <TextBlock Text="{Binding xpto}"/>
                <ListBox ItemTemplate="{StaticResource anotherItemTemplate}"></ListBox>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <ListBox ItemTemplate="{StaticResource itemTemplate}"></ListBox>
    </Grid>
于 2013-05-27T16:25:22.120 回答