首页 新闻 会员 周边

WPF materialDesign日期时分秒控件签名问题

0
悬赏园豆:30 [已关闭问题] 关闭于 2021-06-24 16:26

materialDesign版本是4.0

System.Windows.Markup.XamlParseException:““无法从文本“CombinedDialogOpenedEventHandler”创建“DialogOpenedAttached”。”,行号为“20”,行位置为“5”。”
ArgumentException: 无法绑定到目标方法,因其签名或安全透明度与委托类型的签名或安全透明度不兼容。

代码如下:
<StackPanel
Orientation="Horizontal">
<TextBlock
Text="{Binding Date, 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="0"
      Orientation="Horizontal">
                        <Calendar
        x:Name="CombinedCalendar"
        Margin="-1 -4 -1 0" />
                        <materialDesign:Clock
        x:Name="CombinedClock"
        DisplayAutomation="CycleWithSeconds"
        Is24Hours="True" />
                    </StackPanel>
                    <StackPanel
      Grid.Row="1"
      Margin="8"
      HorizontalAlignment="Right"
      Orientation="Horizontal">
                        <Button
        Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
        CommandParameter="0"
        Style="{DynamicResource MaterialDesignFlatButton}">
                            CANCEL
                        </Button>
                        <Button
        Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
        CommandParameter="1"
        Style="{DynamicResource MaterialDesignFlatButton}">
                            OK
                        </Button>
                    </StackPanel>
                </Grid>
            </Button.CommandParameter>
        </Button>
    </StackPanel>
小代码大世界的主页 小代码大世界 | 初学一级 | 园豆:31
提问于:2021-06-24 16:22
< >
分享
所有回答(1)
0

能否提供一个Demo

楚人Leo | 园豆:803 (小虾三级) | 2021-06-26 13:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册