我正在使用Jarloo的日历控件,并对其进行了一些更改以满足我的需求。我已经为此苦苦挣扎了很长时间,但我不知道问题可能的原因是什么。
所以,我的问题是我的所有命令绑定都无法工作。
在这里,按键绑定不起作用,但是
在 calendar.cs 文件中:
所以,我的问题是我的所有命令绑定都无法工作。
<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>
在这里,按键绑定不起作用,但是
{Binding Typologies}
和其他数据绑定都很好地工作。这让我认为这不是数据上下文的问题。<Button DockPanel.Dock="Left" Margin="0,0,10,0" Content="<<" Command="{Binding ChangeDateCmd}" CommandParameter="YEAR,PREV"/>
在这里,我的命令绑定根本不起作用,而这个:
<TextBlock Padding="5" Text="{Binding TargetDate, Converter={StaticResource DateConverter}, ConverterParameter=MONTH}"/>
正常工作...
在 day.cs 中:
private ICommand cancelDispatchCommand;
public ICommand CancelDispatchCommand
{
get
{
return cancelDispatchCommand = cancelDispatchCommand ?? new ActionCommand((o) => CancelDispatch(o));
}
}
在 calendar.cs 文件中:
ICommand changeDateCmd;
public ICommand ChangeDateCmd
{
get
{
return changeDateCmd = changeDateCmd ?? new ActionCommand((o) => ChangeDate(o));
}
}