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.
Hello Venkata,
I am just checking it you have any further questions on this matter. Please do not hesitate to let me know if you do.
Thank you for your post!
I have been looking into your issue and have created a small sample application in order to test the issue you have reported. I was not able to reproduce the issue. I am attaching the sample application I have been testing with. Would you please modify the sample application with the functionality you are using, so it reproduces the issue?
Please note that the “IsEnabled” property is of type Boolean and the converter should return a Boolean value. More about this you can find on the following link: http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(System.Windows.UIElement.IsEnabled)&rd=true.
Thank you for the cooperation. Looking forward to hearing from you.