我很难在WPF中执行 < a href="http://en.wikipedia.org/wiki/Miller_columns" rel=“nofollow”>Miller 列 接口,想知道是否有人看到我可以借用的操作。我做了一些搜索,找不到自己的东西。
目前我的数据是按等级排列的, 以便放在树观中, 但我想在我的节目中加上米勒列的观点。
我很难在WPF中执行 < a href="http://en.wikipedia.org/wiki/Miller_columns" rel=“nofollow”>Miller 列 接口,想知道是否有人看到我可以借用的操作。我做了一些搜索,找不到自己的东西。
目前我的数据是按等级排列的, 以便放在树观中, 但我想在我的节目中加上米勒列的观点。
UPDATE 我在几个博客文章中强化了我的解决方案,这些文章可以找到 这里 和https://codingforsmarties.wwfspress.com/2015/11/17/wpf-miller-clouns-part-2" rel="nofollow">。新版本允许使用MVM的更通用方法。
我找到了一个可能的解决办法,菲尔确认这是正确的方法。我不得不使用一个带有水平堆叠板的物品控制器作为物品管理板。然后我为我的数据类型创建了一个数据模板,并将其用于我物品控制板上的项目控制板。
数据模板 :
<DataTemplate x:Key="DataNodeStackedDataTemplate" DataType="my:DataNode">
<ListBox ItemsSource="{Binding Children}"
Style="{StaticResource StackedListBoxStyle}"/>
</DataTemplate>
物品管制:
<ItemsControl x:Name="MillerColumnsView" VerticalContentAlignment="Stretch"
ItemTemplate="{StaticResource DataNodeStackedDataTemplate}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
代码后面:
private void StackedListBox_SelectionChanged(object sender,
SelectionChangedEventArgs e)
{
var lb = sender as ListBox;
if (lb == null) return;
var dn = lb.DataContext as DataNode;
if (dn == null) return;
int index = MillerColumnsView.Items.IndexOf(dn);
if (index == -1) return;
index++;
while (MillerColumnsView.Items.Count > index)
MillerColumnsView.Items.RemoveAt(index);
if (dn.Children == null) return;
// this Select() call performs some restructuring of the tree to
// appropriate display the correct nodes in the next ListBox
dn.Select(dn.AvailableItems.ElementAt(lb.SelectedIndex));
if (dn.Children.Count() == 0) return;
MillerColumnsView.Items.Add(dn.Children.ElementAt(0));
}
此选项自动删除并创建每个级别选择的 ListBox 。 一个小符号, 它看起来也很漂亮!
Miller 列的 UI 看起来像多个链接的列表框控件 。
这里举个例子:WPF MVVM等级选择的项目
I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...
Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...
I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...
Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...
Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...
I ve got some code which sets up a datacontext. Often enough, the datacontext should be set to some underlying data collection, such as an ObservableCollection - but occasionally I d like to set it ...
I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...
NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...