【问题标题】:How to I pass additional data to a bound datagrid?如何将其他数据传递给绑定的数据网格?
【发布时间】:2017-07-27 22:51:06
【问题描述】:

假设我有一个绑定到对象的数据网格,有什么方法可以将添加列表/变量传递给它?

具体来说:

<DataGrid x:Name="IndoorUnitTable" ItemsSource="{Binding BoundList, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"   
...
       <DataTemplate x:Name="PropertyFromOtherTable">
             <TextBlock Text="{Binding OtherListIWant, Mode=TwoWay, Converter={StaticResource ConverterForTwoLists}, UpdateSourceTrigger=PropertyChanged}"/>
       </DataTemplate>

【问题讨论】:

  • 你的问题很不清楚。是否要合并列表以使表中的行数成为每个列表中的行数之和?或者你想加入列表,使得表中的列数是两个列表中列的总和?每种方法都需要不同的方法。
  • 你的问题不清楚。

标签: wpf data-binding datagrid


【解决方案1】:

您必须在 Binding 中使用 ConverterParameter,这将作为参数传递给转换器。我希望我正确理解了您的问题;)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-10
    • 1970-01-01
    • 2021-11-15
    相关资源
    最近更新 更多