Ich verwende Material Design für WPF. Ich versuche Dialoge zu verwenden. Hier ist mein Dialog Inhalt:Material Design WPF-Befehl Problem
<materialDesign:DialogHost.DialogContent>
<Label></Label>
</materialDesign:DialogHost.DialogContent>
ich auch mit den Tasten Popup haben Box was Dialoge erzeugen. Popup-Dialog ist innerhalb von DialogHost
wie folgt:
<materialDesign:PopupBox.ToggleCheckedContent>
<materialDesign:PackIcon Kind="Close" Width="24">
</materialDesign:PopupBox.ToggleCheckedContent>
<StackPanel>
<Button ToolTip="Add Audio" Background="#449AB8" BorderBrush="#449AB8" Command="{Binding AddAudioCommand}">
<materialDesign:PackIcon Foreground="White" Kind="Microphone" />
</Button> <!-- This Command is working-->
<Button ToolTip="Add Picture" Background="#449AB8" BorderBrush="#449AB8" Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}">
<materialDesign:PackIcon Foreground="White" Kind="Camera" />
<Button.CommandParameter>
<StackPanel Margin="16">
<TextBlock HorizontalAlignment="Center" FontSize="15">Add Image</TextBlock>
<Button Style="{StaticResource MaterialDesignFlatButton}"
IsDefault="True"
Margin="0 10 10 0"
Command="{Binding Path=AddPictureCommand}">
Attach from disc
</Button>
<Button Style="{StaticResource MaterialDesignFlatButton}"
IsCancel="True"
Margin="0 8 8 0">
Take a photo
</Button>
<Button Style="{StaticResource MaterialDesignFlatButton}"
IsCancel="True"
Margin="0 8 8 0"
Command="materialDesign:DialogHost.CloseDialogCommand">
<Button.CommandParameter>
<system:Boolean>False</system:Boolean>
</Button.CommandParameter>
Discard
</Button>
</StackPanel>
</Button.CommandParameter>
</Button>
</stackpanel>
...
Wie ich verstehe ich layout
von Dialog zu DialogContent
sende. Der erste Befehl funktioniert jedoch (Audio hinzufügen). Die zweite Schaltfläche "Bild hinzufügen" sendet StackPanel
an DialogContent
. Der Dialog funktioniert, es erscheint, aber mein Befehl funktioniert nicht. Es ist komisch, weil Befehl zum Schließen funktioniert. Das Problem ist, dass es nicht in die Command Execute-Methode gelangt.