我有一个按钮进入绑定到 ICommand 的 WPF 窗口
<Button Style="{StaticResource ToolBarButtonSearchTime}">
<Button.Command>
<Binding Path="FiltrarPlanillasCommand">
<Binding.ValidationRules>
<ExceptionValidationRule/>
</Binding.ValidationRules>
</Binding>
</Button.Command>
</Button>
这是执行的方法
public void FiltrarPlanillasExecute(object p)
{
FiltrosDocumento filtro = new FiltrosDocumento();
filtro.ListaBodegasAcopio = ListaBodegasSeleccionadas;
filtro.FechaInicial = FechaInicial;
filtro.FechaFinal = FechaFinal;
filtro.IntIdmodulo = IntIdModulo;
try
{
filtro.PlanillaAcopioLiquidada = PlanillaAcopioLiquidada;
ListaPlanillas = null;
ListaPlanillas = new ObservableCollection<Merlin_MovimientoDocumentosFacturacion_Enc>(
ListaDocumentos.PlanillasAcopio(filtro, db)
);
((DelegateCommand)_ICommandParadigmaNPrint).RaiseCanExecuteChanged();
}
catch (Exception)
{
// Here this exception wasn't catched
throw;
}
}
为什么如果<ExceptionValidationRule/>
已设置,它不会捕获异常?我的代码有什么问题?