Reputation: 495
I used the code in the Material Design in XAML Toolkit, which is below the code.
<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>
But I got a lot of errors. I couldn't fix errors because I'm new to wpf.
How can I fix the errors?
Edit: After The materialDesign prefix be mapped, It gives another error:
"Failed to create a 'DialogOpenedAttached' from the text 'CombinedDialogOpenedEventHandler'.' Line number '21' and line position '48'.'"
Upvotes: 3
Views: 4059
Reputation: 169320
The materialDesign
prefix should be mapped to the http://materialdesigninxaml.net/winfx/xaml/themes
XAML namespace:
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
Upvotes: 2