I have a grid with 2 template columns next to each other if a specific value is selected in the first cell I need the second cell to enable/disable appropriately here is the xaml for my two cells
1rst cell that should initiate the enable eisable the value I'm looking at is the key
<igGrid:TemplateColumn Key="CategoryClass" IsFilterable="True" MinimumWidth="150" Width="Auto" IsResizable="True" IsReadOnly="True" FilterColumnSettings="{StaticResource FilterColumnSettingsBool}"> <igGrid:TemplateColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="Type" /> </DataTemplate> </igGrid:TemplateColumn.HeaderTemplate> <igGrid:TemplateColumn.ItemTemplate> <DataTemplate> <igXamCombo:XamComboEditor x:Name="cboCategoryClass" Width="100" ItemsSource="{StaticResource CategoryClassOptionsList}" SelectedItem="{Binding CategoryClass, Mode=TwoWay, Converter={StaticResource CategoryClassConverter} ,ConverterParameter={StaticResource CategoryClassOptionsList}}" DisplayMemberPath="Text" IsEditable="False"> </igXamCombo:XamComboEditor> </DataTemplate> </igGrid:TemplateColumn.ItemTemplate> <igGrid:TemplateColumn.FilterEditorTemplate > <DataTemplate > <igXamCombo:XamComboEditor x:Name="cboCategoryClassF" Width="100" ItemsSource="{StaticResource CategoryClassOptionsList}" SelectedItem="{Binding Value, Mode=TwoWay, Converter={StaticResource CategoryClassConverter} ,ConverterParameter={StaticResource CategoryClassOptionsList}}" DisplayMemberPath="Text" IsEditable="False"> </igXamCombo:XamComboEditor> </DataTemplate> </igGrid:TemplateColumn.FilterEditorTemplate> <igGrid:TemplateColumn.FilterItemTemplate> <DataTemplate> <igXamCombo:XamComboEditor x:Name="cboCatClass" Width="100" ItemsSource="{StaticResource CategoryClassOptionsList}" SelectedItem="{Binding Value, Mode=TwoWay, Converter={StaticResource CategoryClassConverter} ,ConverterParameter={StaticResource CategoryClassOptionsList}}" DisplayMemberPath="Text" IsEditable="False"> </igXamCombo:XamComboEditor> </DataTemplate> </igGrid:TemplateColumn.FilterItemTemplate> </igGrid:TemplateColumn>
second column that should enable/disable unfortunately the call to the converter never gets called?????
<igGrid:TemplateColumn Key="VisitBased" IsFilterable="True" MinimumWidth="150" Width="Auto" IsResizable="True" IsReadOnly="True" FilterColumnSettings="{StaticResource FilterColumnSettingsBool}"> <igGrid:TemplateColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="Basis" /> </DataTemplate> </igGrid:TemplateColumn.HeaderTemplate> <igGrid:TemplateColumn.ItemTemplate> <DataTemplate> <igXamCombo:XamComboEditor x:Name="cboVisitBased" Width="100" ItemsSource="{StaticResource VisitBasedOptionsList}" SelectedItem="{Binding VisitBased, Mode=TwoWay, Converter={StaticResource VisitBasedConverter} ,ConverterParameter={StaticResource VisitBasedOptionsList}}" DisplayMemberPath="Text" IsEnabled="{Binding CategoryClass,Converter={StaticResource VisitBasedConverterEnabled},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,BindsDirectlyToSource=True}" IsEditable="False"> </igXamCombo:XamComboEditor> </DataTemplate> </igGrid:TemplateColumn.ItemTemplate> <igGrid:TemplateColumn.FilterEditorTemplate > <DataTemplate > <igXamCombo:XamComboEditor x:Name="cboVisitBased" Width="100" ItemsSource="{StaticResource VisitBasedOptionsList}" SelectedItem="{Binding Value, Mode=TwoWay, Converter={StaticResource VisitBasedConverter} ,ConverterParameter={StaticResource VisitBasedOptionsList}}" DisplayMemberPath="Text" IsEditable="False"> </igXamCombo:XamComboEditor> </DataTemplate> </igGrid:TemplateColumn.FilterEditorTemplate> <igGrid:TemplateColumn.FilterItemTemplate> <DataTemplate> <igXamCombo:XamComboEditor x:Name="cboVisitBased" Width="100" ItemsSource="{StaticResource VisitBasedOptionsList}" SelectedItem="{Binding Value, Mode=TwoWay, Converter={StaticResource VisitBasedConverter} ,ConverterParameter={StaticResource VisitBasedOptionsList}}" DisplayMemberPath="Text" IsEditable="False"> </igXamCombo:XamComboEditor> </DataTemplate> </igGrid:TemplateColumn.FilterItemTemplate> </igGrid:TemplateColumn>-
Hello Nick,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I bound the second TempalteColumn’s IsEnabled Property to the first one’s value. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
this is a little basic and is very similar to what I already sent you in my sample xaml.
the changing value I need to test for is a string value that needs to run through a converter. My converter is not firing.
I wish my scenario was as simple as the example you here is the xaml and the 2 converters (the Categoryclass converter fires as expected, the Visitbased one does not
public class VisitBasedConverterEnabled:IValueConverter { public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) { if (value == null) return true; //Item template for filter bool val = false; string rst = value.ToString(); if (rst == "Hospital") val= false; else if (rst == "Provider") val= true; return val; } public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) { return value; } }
public class CategoryClassConverter : IValueConverter { public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture) { DropdownBoxOptions selectedItem = null; CategoryClassOptionsList values = parameter as CategoryClassOptionsList; if (values != null && value != null) { string selectedValue = (string)value; foreach (DropdownBoxOptions item in values) { if (item.Value != selectedValue) continue; selectedItem = item; break; } } return selectedItem; } public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture) { string result = ""; DropdownBoxOptions selectedType = value as DropdownBoxOptions; if (selectedType != null) result = selectedType.Value; return result; } }
private static VisitBasedCollection SetupEnum() { if (VisitBasedOptionsList.items == null) { VisitBasedOptionsList.items = new VisitBasedCollection(); DropdownBoxOptionsTypeBoolean item0 = ModelEntityBase.CreateAsNew<DropdownBoxOptionsTypeBoolean>(); item0.Text = "Episodic"; item0.Value = true; items.Add(item0); DropdownBoxOptionsTypeBoolean item1 = new DropdownBoxOptionsTypeBoolean(); item1.Text = "Patient"; item1.Value = false; items.Add(item1); }
}
private static CategoryClassBasedCollection SetupEnum() { if (CategoryClassOptionsList.items == null) { CategoryClassOptionsList.items = new CategoryClassBasedCollection(); DropdownBoxOptions item0 = ModelEntityBase.CreateAsNew<DropdownBoxOptions>(); item0.Text = "Hospital"; item0.Value = "Hospital"; items.Add(item0); DropdownBoxOptions item1 = new DropdownBoxOptions(); item1.Text = "Provider"; item1.Value = "Provider"; items.Add(item1); }
values for visitbased list