Ogie
Ogie

Reputation: 59

How to fix "materialDesign" is not defined in wpf/xaml

I recently added material design to my wpf project. Everything worked fine so far, untill I tried to add a dialog.
https://gyazo.com/13e65442cdd241108fa397bd1c5695e6

I googled the whole internet off but could not find a solution

<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>

Getting the following error: https://gyazo.com/c3038b28c90ebd81c94bea5a7bc9b671

I expected to have a dialog like in the demo of material design toolkit.

https://gyazo.com/435b4136a05678455386848548c9c6de

Upvotes: 0

Views: 2154

Answers (1)

Ogie
Ogie

Reputation: 59

I had to add: xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" at the top of the xaml file

Upvotes: 5

Related Questions