使用日期和时间选择器时出现问题,该选择器是从“材料设计演示”中复制的。当我使用此自定义对话框时,会出现以下错误:
ArgumentException:无法绑定到目标方法,因为其签名或安全透明性与委托类型的签名或安全透明性不兼容。
我希望它与DialogHost.OpenDialogCommand或
有关materialDesign:DialogHost.DialogOpenedAttached="CombinedDialogOpenedEventHandler"
当我使用Material Design Demo的日期选择器时,我的代码可以正常工作而没有任何问题。
XAML代码:
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="{Binding Inspection.startDateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}" VerticalAlignment="Center" FontSize="24" />
<Button Margin="8 0 0 0" Content="..." Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}" materialDesign:DialogHost.DialogOpenedAttached="CombinedDialogOpenedEventHandler" materialDesign:DialogHost.DialogClosingAttached="CombinedDialogClosingEventHandler">
<Button.CommandParameter>
<Grid Margin="-1">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="2" Orientation="Horizontal">
<Calendar x:Name="CombinedCalendar" Margin="-1 -4 -1 0" />
<materialDesign:Clock x:Name="CombinedClock" DisplayAutomation="CycleWithSeconds" Is24Hours="True" />
</StackPanel>
<StackPanel Grid.Row="2" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="1" Style="{DynamicResource MaterialDesignFlatButton}">
OK
</Button>
<Button Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" CommandParameter="0" Style="{DynamicResource MaterialDesignFlatButton}">
CANCEL
</Button>
</StackPanel>
</Grid>
</Button.CommandParameter>
</Button>
</StackPanel>
编辑