【问题标题】:convert DataGridTextColumn with MultiBinding to telerik using WPF使用 WPF 将具有 MultiBinding 的 DataGridTextColumn 转换为 telerik
【发布时间】:2013-09-11 20:09:53
【问题描述】:
  <DataGridTextColumn Header="Total"  Width="SizeToHeader" IsReadOnly="True">
      <DataGridTextColumn.Binding>
        <MultiBinding Converter="{StaticResource testname}">
             <Binding Path="test1"/>
             <Binding Path="test2"/>
        </MultiBinding>
      </DataGridTextColumn.Binding>
  </DataGridTextColumn>

public class testnameConverter : IMultiValueConverter
{
    public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        int dose = 0;
        int waste = 0;

        Int32.TryParse(values[0].ToString(), out dose);
        Int32.TryParse(values[1].ToString(), out waste);

        int total = dose + waste;

        return total.ToString();
    }

    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotSupportedException();
    }
}

我想知道如何将 DataGridTextColumn 转换为 telerik,因为 telerik 不支持 telerik:GridViewDataColumn.Binding。有人可以告诉我如何使用我的转换器进行这项工作。

【问题讨论】:

    标签: wpf telerik wpf-controls wpftoolkit


    【解决方案1】:
      <telerik:GridViewDataColumn.CellTemplate>
         <DataTemplate>
             <TextBlock>
                 <TextBlock.Text>
                    <MultiBinding Converter="{StaticResource testname}">
                        <Binding Path="test1"/>
                        <Binding Path="test2"/>
                    </MultiBinding>
                 </TextBlock.Text>
             </TextBlock>
         </DataTemplate>
      </telerik:GridViewDataColumn.CellTemplate>
    

    【讨论】:

      猜你喜欢
      • 2013-04-20
      • 2018-03-30
      • 2012-07-20
      • 2011-10-10
      • 1970-01-01
      • 2013-03-23
      • 2011-06-17
      • 2015-05-16
      • 2016-04-03
      相关资源
      最近更新 更多