将多个动态值传递给转换器WPF

时间:2015-09-29 12:15:41

标签: c# wpf xaml telerik imultivalueconverter

我正在使用WPF应用程序,我正在使用telerik:RadGridView,我必须在某些条件下创建列ReadOnly。条件值位于与gridview绑定的集合中,也包含ViewModel中的某些值。

// XAML中:

<telerik:GridViewComboBoxColumn ItemsSource="{Binding StatusList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource SimplifiedView}"  SelectedValueMemberPath="StatusId" DisplayMemberPath="StatusName" DataMemberBinding="{Binding StatusName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
   <telerik:GridViewComboBoxColumn.CellStyle>   
     <Style TargetType="{x:Type telerik:GridViewCell}">
           <Style.Triggers>
              <DataTrigger Binding="{Binding MemberId, Converter={StaticResource IntBoolConverter}}" Value="False" >
           <Setter Property="Background" Value="White" />
              </DataTrigger>
           </Style.Triggers>
     </Style>
   </telerik:GridViewComboBoxColumn.CellStyle>
</telerik:GridViewComboBoxColumn>

我必须使用MemberIdViewModel中的其他值传递给转换器并进行一些返回boolean值的计算。将值分配给IsReadOnlyBinding的{​​{1}}属性可使其正常工作。

//静态数组:

GridViewColumn

我已经处理了上面的代码,其中静态值作为数组传递给转换器,但我需要将动态值(例如 <telerik:RadWindow.Resources> <x:Array x:Key="CustomValues" Type="sys:String" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib"> <sys:String>Yes</sys:String> <sys:String>No</sys:String> </x:Array> </telerik:RadWindow.Resources> IsReadOnly="{Binding Source={StaticResource CustomValues}, Converter={StaticResource MultipleValueForReadOnly}}" )发送到转换器。

我怎样才能实现这个目标?

0 个答案:

没有答案