vendredi 17 juin 2016

Disable CheckBox with conditions

I have CheckBox and two TimePicker controls. I want to make checkbox enable when diff from TimePicher2-TimePicker1>0. And disable it overwise.

Can i make it in XAML?

Here the code:

<xctk:TimePicker Grid.Row="1" Grid.Column="0" Height="22" HorizontalAlignment="Stretch"
                                 Format="ShortTime" Margin="8,0,0,0"
                                 Value="{Binding ViewModel.StartTime,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                 ></xctk:TimePicker>

<xctk:TimePicker Grid.Row="3" Grid.Column="0" Height="22" HorizontalAlignment="Stretch"
                                 Format="ShortTime"  Margin="8,0,0,0"
                                 Value="{Binding ViewModel.EndTime,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                 ></xctk:TimePicker>
<CheckBox Grid.Row="4"
                      HorizontalAlignment="Left" VerticalAlignment="Center"
                      Margin="8,0,0,0" 
                     ??? IsEnabled="{Binding ElementName=}"
                      IsChecked="{Binding ViewModel.Date,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                      />




Aucun commentaire:

Enregistrer un commentaire