我有以下代码:
<ribbon:Ribbon.ApplicationMenu>
<ribbon:RibbonApplicationMenu ToolTipTitle="Application Menu">
<ribbon:RibbonApplicationMenuItem Header="Company"
x:Name="MenuItem_Company"
ImageSource="Images\LargeIcon.png"
Command="{Binding Path=CompanyCommand}">
<StackPanel>
<TextBlock Text="Item 1 in the list" />
<TextBlock Text="Item 2 in the list" />
<TextBlock Text="Item 3 in the list" />
<TextBlock Text="Item 4 in the list" />
</StackPanel>
</ribbon:RibbonApplicationMenuItem>
<ribbon:RibbonApplicationMenuItem Header="DocStore Settings"
x:Name="MenuItem1"
ImageSource="Images\LargeIcon.png"
Click="MenuItem1_Click"/>
<ribbon:RibbonApplicationMenuItem Header="About DocStore"
x:Name="MenuItem2"
ImageSource="Images\LargeIcon.png"
Click="MenuItem2_Click" />
<ribbon:RibbonApplicationMenuItem Header="Exit"
x:Name="MenuExit"
ImageSource="Images\LargeIcon.png"
Click="Exit" />
</ribbon:RibbonApplicationMenu>
</ribbon:Ribbon.ApplicationMenu>
我想在第一个 RibbonApplicationMenuItem 内将项目动态添加到我的堆栈面板,以替换硬编码的 TextBlock 项目。我不知道会有多少可用,我以4为例。
这可能吗?如果是这样,我该怎么做?
谢谢!爱罗克