【发布时间】:2011-07-31 01:13:35
【问题描述】:
我需要实现一个主/详细信息View,将DataGrid 作为主控,很可能TextBlock 或TextBox 组件显示每个行字段的详细信息——尽管我知道@ 987654325@ 组件我不确定这是否是解决方案,因为目前我不需要支持对该数据的 CRUD 操作。
So the problem is basically how to bind each DataGridTextColumn to a particular Text property of any given control (e.g. TextBlock) having its values uptated when a different row is selected.
XAML 代码如下所示:
<!-- Master -->
<sdk:DataGrid x:Name="FoobarDataGrid" DataContext="foobar" AutoGenerateColumns="False">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn x:Name="FooDataGridColumn" Header="Foo" Binding="{Binding Foo}" />
<sdk:DataGridTextColumn x:Name="BarDataGridColumn" Header="Bar" Binding="{Binding Bar}" />
</sdk:DataGrid.Columns>
</sdk:DataGrid>
<!-- Details -->
<TextBox x:Name="FooDetailsTextBlock" Text="{Binding <!-- TODO -->}" />
<TextBox x:Name="BarDetailsTextBlock" Text="{Binding <!-- TODO -->}" />
请不要犹豫,询问任何其他细节,我们将不胜感激每一个建议。
【问题讨论】:
标签: c# silverlight datagrid silverlight-toolkit