【问题标题】:StatusBar at the bottom of a DataGridDataGrid 底部的状态栏
【发布时间】:2012-03-29 09:08:50
【问题描述】:

如何扩展 Datagrid 以在其底部添加 StatusBar?它应该是这样的:

<CustomControl>   
     <StackPanel>
          <DataGrid></DataGrid>
          <StatusBar></StatusBar>
     </StackPanel>
</CustomControl>

如果我将创建 CustomControl,那么我将无法在使用该控件时指定 DataGrid.ItemSource 和 DataGrid.SelectedItem。

但我想这样使用它:

<CustomDataGrid ItemSource="{Binding Something}" SelectedItem="{Binding Otherthing}">
     <CustomDataGrid.Columns>
          <DataGridTextColumn/>
          <DataGridTextColumn/>
     </CustomDataGrid.Columns>
</CustomDataGrid>

【问题讨论】:

  • 喜欢最后一排?只是一个任意控制?请提供更多信息。一般来说,我会说,将DataGrid 和您的StatusBar 控件放入DockPanel 并根据需要对齐它们,但没有更多信息,这只是一个疯狂的猜测......

标签: wpf datagrid controltemplate


【解决方案1】:

如果我理解你想绑定到用户控件中的 DataGrid ItemsSourceSelectedItem 依赖属性

这里解释了怎么做

http://social.msdn.microsoft.com/Forums/en/wpf/thread/9e4b0709-ca4e-4ed4-9fad-47ed73c120f6

该示例适用于ItemsSource,但从它应该很容易扩展SelectedItem的代码

希望对你有帮助

【讨论】:

  • 没错,但我也想像简单的 DataGrid 一样声明 Columns。
猜你喜欢
  • 2011-03-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多