Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
760
How to disable a cell in XamDataGrid based on its value
posted

Hi,

I am trying to do  this by a Converter function.

The code looks like this:

 

<igDp:UnboundField Name="ItemCode" BindingPath="ItemCode" BindingMode="TwoWay" Label="P or LE" Width="50" ToolTip="P = Plan, PA = Plan Actual, LE = Latest Estimate">

<igDp:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}" LabelTextAlignment="Center" DataValueChangedNotificationsActive="True" AllowEdit="True">

    <igDp:FieldSettings.EditorStyle>

         <Style TargetType="{x:Type igEditors:XamComboEditor}">

                <Setter Property="ItemsSource" Value="{Binding DataContext.ItemCodes, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}, AncestorLevel=1}}" />

                                 <Setter Property="SelectedItem" Value="ItemCode" />

                                 <Setter Property="IsEnabled" Value="{Binding Path=ItemCode, Converter={StaticResource PorLeConverter}, ConverterParameter=1}"/>

                  </Style>

          </igDp:FieldSettings.EditorStyle>

 </igDp:FieldSettings>

</igDp:Field.Settings>

</igDp:UnboundField>

 

And i have a converter function which looks like this:

public class PorLeAllowEditConverter : IValueConverter

{

    public object Convert (object value, Type targetType, object parameter, CultureInfo culture)

    {

     var porLe = (string)value;

     return porLe != "PA";

    }

   public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)

    {   throw new NotImplementedException();   }

For some reason, this dosent work. The converter is not being called.

Can you let me know what am i missing here? thanking you in advance.