コード例 #1
0
        protected override FrameworkElement PrepareItemContainer(object dataItem)
        {
// ReSharper disable UseObjectOrCollectionInitializer
            TreeViewItem container = new TreeViewItem
// ReSharper restore UseObjectOrCollectionInitializer
            {
                Content       = dataItem,
                Context       = dataItem,
                ForceExpander = ForceExpander,
                Screen        = Screen,
                ElementState  = _elementState,
                LogicalParent = this,
            };

            // Set this after the other properties have been initialized to avoid duplicate work
            container.Style           = MpfCopyManager.DeepCopyCutLVPs(ItemContainerStyle);
            container.ContentTemplate = MpfCopyManager.DeepCopyCutLVPs(ItemTemplate);

            // Re-use some properties for our children
            container.ItemContainerStyle = MpfCopyManager.DeepCopyCutLVPs(ItemContainerStyle);
            container.ItemsPanel         = MpfCopyManager.DeepCopyCutLVPs(ItemsPanel);
            container.ItemTemplate       = MpfCopyManager.DeepCopyCutLVPs(ItemTemplate);
            container.SubItemsProvider   = MpfCopyManager.DeepCopyCutLVPs(SubItemsProvider);
            return(container);
        }
コード例 #2
0
    protected override FrameworkElement PrepareItemContainer(object dataItem)
    {
// ReSharper disable UseObjectOrCollectionInitializer
      TreeViewItem container = new TreeViewItem
// ReSharper restore UseObjectOrCollectionInitializer
        {
            Content = dataItem,
            Context = dataItem,
            ForceExpander = ForceExpander,
            Screen = Screen,
            ElementState = _elementState,
            LogicalParent = this,
        };
      // Set this after the other properties have been initialized to avoid duplicate work
      container.Style = MpfCopyManager.DeepCopyCutLVPs(ItemContainerStyle);
      container.ContentTemplate = MpfCopyManager.DeepCopyCutLVPs(ItemTemplate);

      // Re-use some properties for our children
      container.ItemContainerStyle = MpfCopyManager.DeepCopyCutLVPs(ItemContainerStyle);
      container.ItemsPanel = MpfCopyManager.DeepCopyCutLVPs(ItemsPanel);
      container.ItemTemplate = MpfCopyManager.DeepCopyCutLVPs(ItemTemplate);
      container.SubItemsProvider = MpfCopyManager.DeepCopyCutLVPs(SubItemsProvider);
      return container;
    }