wpf / xaml中未定义如何修复“ materialDesign”

时间:2019-05-14 13:07:19

标签: wpf xaml

我最近在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>

出现以下错误: https://gyazo.com/c3038b28c90ebd81c94bea5a7bc9b671

我希望像材料设计工具包演示中那样有一个对话框。

https://gyazo.com/435b4136a05678455386848548c9c6de

1 个答案:

答案 0 :(得分:0)

我必须添加:xmlns:materialDesign =“ http://materialdesigninxaml.net/winfx/xaml/themes” 在xaml文件的顶部