我是WPF开发人员的初学者。 我创建了一些框架内的窗口。 我为框架写了一个模板,我试图绑定到freame模板命令中的按钮,但没有成功。绑定一个命令不起作用
看到下面的代码:
<Grid.Resources>
<ControlTemplate TargetType="Frame" x:Key="NavigationButtonsTemplates">
<DockPanel>
<StackPanel
Margin="7"
Orientation="Horizontal"
DockPanel.Dock="Bottom"
HorizontalAlignment="Right"
>
<Button
Content="Back"
Command="{x:Static NavigationCommands.BrowseBack}"
Margin="5,0,5,0" Width="80" />
<Button
Content="Next"
Command="{Binding Path=NavigateToPersonalDataCommand}"
Margin="5,0,5,0" Width="80"></Button>
</StackPanel>
<Border
BorderBrush="LightBlue"
Margin="7,8,9,0"
BorderThickness="7"
Padding="5"
CornerRadius="7"
Background="White"
>
<ContentPresenter />
</Border>
</DockPanel>
</ControlTemplate>
</Grid.Resources>
看来这个按钮的结合是行不通的。 当我把按钮放在标签外面时,它的功能完美无缺。 如何将命令绑定到位于的按钮?
感谢
仍然无法正常工作,我尝试了两种选择。这些按钮不执行任何命令。 – Ofir
有没有其他想法? – Ofir
@CharlieGrinvald你可以发布你使用模板的代码吗?我需要更多信息。 –