This question is locked. New answers and comments are not allowed.
I have two RadButtons, a RadComboBox, and a ListBox on a UserControl. I'm trying to bind the IsEnabled property of the Add button to the SelectedItem property of the combo box using a ValueConverter. My xaml looks like so:
And my SelectedItemToBoolConverter class looks like this:
This works fine when binding the IsEnabled property of the Delete button to the SelectedItem property of the ListBox, but does not execute when binding the IsEnabled property of the Add button to the SelectedItem property of the RadComboBox.
Is there a reason this functionality does not work between those two controls?
Thanks.
EDIT: This code also works as is if I replace the RadComboBox with a standard silverlight ComboBox.
<UserControl.Resources> <local:SelectedItemToBoolConverter x:Key="SelectedItemToBool"/></UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <StackPanel> <sdk:Label Content="Field Value:"/> <Grid Margin="0 0 0 4"> <telerik:RadComboBox x:Name="fieldComboBox" DisplayMemberPath="Name" SelectedValuePath="Name"/> </Grid> <Grid Margin="0 0 0 4"> <ListBox x:Name="listBox" Height="150" DisplayMemberPath="Name" /> </Grid> <StackPanel Orientation="Horizontal"> <telerik:RadButton x:Name="addButton" Height="25" Width="75" Margin="0 0 2 0" Content="Add" IsEnabled="{Binding ElementName=fieldComobBox, Path=SelectedItem, Converter={StaticResource SelectedItemToBool}}" Click="addButton_Click" /> <telerik:RadButton x:Name="deleteButton" Height="25" Width="75" Margin="0 0 2 0" Content="Delete" IsEnabled="{Binding ElementName=listBox, Path=SelectedItem, Converter={StaticResource SelectedItemToBool}}" Click="deleteButton_Click" /> </StackPanel></Grid>And my SelectedItemToBoolConverter class looks like this:
public class SelectedItemToBoolConverter: IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value != null; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); }This works fine when binding the IsEnabled property of the Delete button to the SelectedItem property of the ListBox, but does not execute when binding the IsEnabled property of the Add button to the SelectedItem property of the RadComboBox.
Is there a reason this functionality does not work between those two controls?
Thanks.
EDIT: This code also works as is if I replace the RadComboBox with a standard silverlight ComboBox.