Binding control to control problems

SuatKorkmazSuatKorkmaz USMember ✭✭✭

I simply want to bind the IsEnabled of a switch to another switch. When main switch is disabled I want the other switch to be desabled. That's all.

I tried:

<Switch x:Name="ToggleNewHomeworkSent" Grid.Row="1" Grid.Column="1" BindingContext="{x:Reference Name=ToggleAllNotifications}" IsEnabled="{Binding IsEnabled}"/>`

Didn't work.

I tried:
ToggleNewHomeworkSent.SetBinding(Switch.IsEnabledProperty, new Binding("IsEnabled", BindingMode.Default, null, null, null, ToggleAllNotifications));

Using ElementName in xaml didn't work either.

What am I doing wrong here?

Thanks in advance.

Best Answer


Sign In or Register to comment.