我需要在下面的TextBlock中显示选定的RibbonMenuButton的值。 RibbonMenuButton的项目定义为ItemTemplate。如何在路径中定义引用?我用“ xxx”标记了
<ribbon:RibbonMenuButton ItemsSource = "{Binding Path=CompaniesList.Companies}" x:Name="rbtnCompanies" Label="{x:Static resources:ConsoliaJPK.SELECT_COMPANY}" SmallImageSource="Resources/Images/Check32.png" Margin="16,0,-15.604,-0.264">
<RibbonMenuButton.ItemTemplate>
<DataTemplate>
<TextBlock x:Name="tblCompany" Text="{Binding Path=Name}" PreviewMouseLeftButtonDown="tblCompany_PreviewMouseLeftButtonDown" >
</TextBlock>
</DataTemplate>
</RibbonMenuButton.ItemTemplate>
</ribbon:RibbonMenuButton>
<TextBlock Text = "{Binding ElementName=rbtnCompanies, Path=xxx}" Margin="41,6,-132,-6.604"></TextBlock>
答案 0 :(得分:0)
我想rbtnCompanies.xxx
应该包含Name
。您可以在您的tblCompany_PreviewMouseLeftButtonDown
中进行此分配。