我最近将材料设计添加到我的 wpf 项目中。到目前为止一切正常,直到我尝试添加一个对话框。
https://gyazo.com/13e65442cdd241108fa397bd1c5695e6
我用谷歌搜索了整个互联网但找不到解决方案
<StackPanel
VerticalAlignment="Center">
<!--the request to open the dialog will bubble up to the top-most DialogHost, but we can used the attached property based event to handle the response -->
<Button
Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
materialDesign:DialogHost.DialogClosingAttached="Sample2_DialogHost_OnDialogClosing"
Width="128">
<Button.CommandParameter>
<StackPanel
Margin="16">
<ProgressBar
Style="{DynamicResource MaterialDesignCircularProgressBar}"
HorizontalAlignment="Center"
Margin="16"
IsIndeterminate="True"
Value="0" />
<Button
Style="{StaticResource MaterialDesignFlatButton}"
IsCancel="True"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
CommandParameter="Sample2Cancel"
HorizontalAlignment="Center">
CANCEL
</Button>
</StackPanel>
</Button.CommandParameter>
PASS VIEW
</Button>
<Button
Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"
Width="128"
Margin="0 32 0 0">
<Button.CommandParameter>
<!-- the simplest view model of all, a DateTime. the view can be found in the resources of MainWindow.xaml -->
<system:DateTime xmlns:system="clr-namespace:System;assembly=mscorlib">
1966-JUL-30
</system:DateTime>
</Button.CommandParameter>
PASS MODEL
</Button>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)
出现以下错误: https://gyazo.com/c3038b28c90ebd81c94bea5a7bc9b671
我期望有一个像材料设计工具包演示中那样的对话框。
我必须在 xaml 文件顶部添加: xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"