【问题标题】:WPF layout problems using Grid and ListBox使用 Grid 和 ListBox 的 WPF 布局问题
【发布时间】:2013-05-09 09:06:19
【问题描述】:

我(有点)是 WPF 的新手。我被这种布局所困扰。 Viewbox 显示良好,ListBox 的空间(30%)也显示良好,但我在该空间中看不到 ListBox。以下是我的 XAML,仅与问题有关。

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="70*"/>
        <RowDefinition Height="30*"/>
    </Grid.RowDefinitions>
    <Viewbox Grid.Row="0" Grid.Column="0" DataContext="{Binding ElementName=thisControl}">
        <ItemsControl ItemsSource="{Binding Path=SomeProperty}" ItemTemplate="{StaticResource SomeTemplate}" >
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </Viewbox>
    <ListBox Grid.Row="1" Grid.Column="0" ItemTemplate="{StaticResource ListBoxItemTemplate}" ItemsSource="{Binding Path=SomeOtherProperty}" Utils:ListBoxExtenders.AutoScrollToEnd="True"/>
</Grid>  

任何帮助将不胜感激。

【问题讨论】:

    标签: wpf listbox grid-layout


    【解决方案1】:

    这是在错误级别定义的DataContextSomeOtherProperty 是该上下文的一部分,没有它,任何数据都不会绑定到 ListBox。但是我仍然对为什么输出窗口中没有任何绑定错误感到困惑。嗯……

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-17
      • 2010-11-19
      • 2011-04-24
      • 2011-06-27
      • 2011-01-22
      • 1970-01-01
      • 1970-01-01
      • 2011-02-24
      相关资源
      最近更新 更多