问题描述
以下是我的 MainWindow.xaml 的摘录。我的问题是关于 ItemsPanel
是通过 ItemsPanelTemplate
<TabControl Grid.Row="2" dd:SmallDragDropHelper.IsDragDropEnhanced="true"
ItemsSource="{Binding Path=TabCollection}" SelectedIndex="{Binding AktIndex,Mode=TwoWay}" TabStripPlacement="Top">
<TabControl.ItemTemplate>
<StaticResource ResourceKey="titemplate"/>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<StaticResource ResourceKey="tctemplate"/>
</TabControl.ContentTemplate>
<TabControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="true"></WrapPanel>
</ItemsPanelTemplate>
</TabControl.ItemsPanel>
</TabControl>
我知道将单个面板类型编写为标签 <ItemsPanelTemplate>
的参数/内容很简单且有效。但我需要/希望的是能够写出以下内容
<ItemsPanelTemplate>
<DockPanel>
<WrapPanel DockPanel.Dock="Left" IsItemsHost="true"></WrapPanel>
<Button DockPanel.Dock="Right">Add</Button>
</DockPanel>
</ItemsPanelTemplate>
目的是,应将 tabitem 标题提供给位于 DockPanel
左侧的换行面板,并且应在同一行中向右对齐显示一个按钮。
但似乎不可能将这种嵌套的面板构造作为 ItemsPanelTemplate
的参数(至少它不符合我的预期)。
在这里进行的正确方法是什么? (谷歌搜索只给了我一个面板作为 ItemsPanelTemplate
参数的例子)。 (我更喜欢不使用 C# 代码,只使用 .xaml 的解决方案)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)