我正在尝试使用LayoutAnchorablePane并在窗口中添加窗格子项,如下所示
<ad:LayoutAnchorablePane DockHeight="Auto" x:Name="LeftTools">
</ad:LayoutAnchorablePane>
在后面的代码中我添加了它的子项
dockSite = new LayoutAnchorable();
LeftTools.Children.Add((LayoutAnchorable)dockSite);
有没有办法绑定它?我在我的VM中完成了这个
// In Constructor
ObservableCollection<LayoutAnchorable> LeftToolList = new ObservableCollection<LayoutAnchorable>();
// Property
public ObservableCollection<LayoutAnchorable> LeftToolList { get; set; }
但是如何绑定到xaml?
答案 0 :(得分:0)
使用ItemsControl
显示收藏中的项目,但告诉它使用哪种面板类型。
<ItemsControl ItemsSource="{Binding LeftToolList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ad:LayoutAnchorablePane/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>