質問

  <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();
    }
}

I was wondering how do I convert the DataGridTextColumn to telerik because telerik does not support telerik:GridViewDataColumn.Binding. Can someone show me how to make this work with my converter.

役に立ちましたか?

解決

  <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>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top