【发布时间】:2019-11-13 00:00:53
【问题描述】:
我在 wpf 的 PopuBox 中有一个按钮 (x:name="MyButton")。
<materialDesign:PopupBox PlacementMode="BottomAndAlignRightEdges"
StaysOpen="True"
Padding="0 0 -1 0"
VerticalAlignment="Center">
<materialDesign:PopupBox.ToggleContent>
<materialDesign:PackIcon Kind="Calendar"
Foreground="{StaticResource PrimaryHueLightBrush}"
Width="20"
Height="20"
VerticalAlignment="Center"/>
</materialDesign:PopupBox.ToggleContent>
<Button Content="Ok"
x:Name ="MyButton"
Style="{DynamicResource MaterialDesignFlatButton}"
Margin="0 5 40 5"
Command="{Binding ClosePopUp}"/>
</materialDesign:PopupBox>
问题是当我单击按钮 (MyButton) 时,该命令将不起作用。我认为这与绑定有关。弹出框外的每个按钮都可以正常工作。
知道有什么问题吗?
编辑
PopupBox 位于 DataTemplate 中
【问题讨论】:
标签: c# wpf data-binding command