lundi 11 mai 2015

WPF Datepicker SelectDateChanged event invoked as view model command not firing

I have A Datepicker control on a Grid that is bound with a Listbox through SelectedItem and the Listbox ItemsSource is a DataTable DefaultView. as shown below

<Grid Name="gridOfferte" DataContext="{Binding ElementName=lstOfferte, Path=SelectedItem}">
   <DatePicker Name="dtpkDataRevOff" Grid.Column="4"   
               SelectedDate="{Binding DataRevOffProperty, Mode=TwoWay}" >
       <i:Interaction.Triggers>
           <i:EventTrigger EventName="SelectedDateChanged">
               <i:InvokeCommandAction Command="{Binding       
                  Path=DatapickerSelectionCommand}" />
           </i:EventTrigger>
       </i:Interaction.Triggers>
   </DatePicker>
   ...
   ...

The DatapickerSelectionCommand doesn't fire. I noticed that the problem is that the Grid containing the Datepicker is bound to the Listbox. If I substitute the line

<Grid Name="gridOfferte" DataContext="{Binding ElementName=lstOfferte, Path=SelectedItem}">

with the line

<Grid Name="gridOfferte">

the DatapickerSelectionCommand fires. What could be the issue?

Thanh you for your support.

Aucun commentaire:

Enregistrer un commentaire