Command bindings do not work when other data bindings work

I use Jarloo's calendar management and add some changes to it to meet my needs. I struggled with this for a long time, and I have no idea what could be causing my problems.

So my problem is that none of my command commands work.

<ListView Background="White"
          SelectionMode="Single"
          dd:DragDrop.DropHandler="{Binding}" 
          dd:DragDrop.IsDropTarget="True"
          dd:DragDrop.UseDefaultDragAdorner="True" 
          ItemsSource="{Binding Typologies}" 
          IsEnabled="{Binding Enabled}">
    <ListView.InputBindings>
        <KeyBinding Key="Delete" Command="{Binding CancelDispatchCommand}" CommandParameter="{Binding SelectedItem}"/>
    </ListView.InputBindings>
....
</ListView>

Here the keyword does not work, but {Binding Typologies}other DATA bindings work well. This made me think that this is not a data problem.

<Button DockPanel.Dock="Left" Margin="0,0,10,0" Content="&lt;&lt;" Command="{Binding ChangeDateCmd}" CommandParameter="YEAR,PREV"/>

In this case, my command binding does not work at all until:

<TextBlock Padding="5" Text="{Binding TargetDate, Converter={StaticResource DateConverter}, ConverterParameter=MONTH}"/>

works great...

In day.cs:

private ICommand cancelDispatchCommand;
public ICommand CancelDispatchCommand
{
    get
    {
        return cancelDispatchCommand = cancelDispatchCommand ?? new ActionCommand((o) => CancelDispatch(o));
    }
}

In calendar.cs:

ICommand changeDateCmd;
public ICommand ChangeDateCmd
{
    get
    {
        return changeDateCmd = changeDateCmd ?? new ActionCommand((o) => ChangeDate(o));
    }
}
+4
source share
1 answer

You do not need to use {Binding} with the command name.

0

All Articles