Esempio n. 1
0
        /// <summary>
        /// Generate TreeViewItem
        /// </summary>
        /// <param name="localizeItemSelector"></param>
        /// <param name="item"></param>
        private void SetNavGroupSubItem(LocalizeItemSelector localizeItemSelector, SystemMenuTreeList item)
        {
            SubItem        = new TreeViewItemEx();
            SubItem.Header = localizeItemSelector.setLocalizeValue(SubItem, TreeViewItemEx.HeaderProperty);
            SubItem.Style  = objtemplate;

            _dicflattenedTree.Add(item.Id, SubItem);
            SubItem.IsExpanded = true;
            if (_dicflattenedTree.ContainsKey(item.PId))
            {
                //// SubItem.ContextMenu = menuAdd;
                _dicflattenedTree[item.PId].Items.Add(SubItem);
            }
            else
            {
                objtree.Items.Add(SubItem);
            }

            var Col = StructureItemsSource.OrderBy(a => a.DisplayIndex).Where(p => p.PId == item.Id);

            if (0 < Col.Count())
            {
                GenerateNavControlTreeStructure(Col);
            }
            else
            {
                SubItem.PageUri = item.PageUri;
                if (!string.IsNullOrEmpty(item.NameClass))
                {
                    SubItem.MouseEnter        += new MouseEventHandler(SubItem_MouseEnter);
                    SubItem.MouseLeftButtonUp += new MouseButtonEventHandler(newItem_MouseLeftButtonUp);
                    SubItem.PreviewKeyDown    += new KeyEventHandler(subItemnew_PreviewKeyDown);
                }
            }
        }
Esempio n. 2
0
 void TreeItemUpdate(TreeViewItemEx item, TreeViewNodeEx node)
 {
     item.Item.DataContext   = item;
     item.Item.AutoColor     = false;
     item.Item.Click         = view.tree.DefultItemClick;
     item.Text.Text          = node.content;
     item.visble.DataContext = item;
     item.visble.Click       = VisbleClick;
     item.visble.AutoColor   = false;
     if (node.active)
     {
         item.visble.Context.MainColor = 0xFFF41FFF.ToColor();
     }
     else
     {
         item.visble.Context.MainColor = Color.gray;
     }
     if (node == view.tree.SelectNode)
     {
         item.Item.Context.MainColor = new Color32(128, 164, 255, 255);
     }
     else
     {
         item.Item.Context.MainColor = new Color32(0, 0, 0, 0);
     }
 }
Esempio n. 3
0
        public static void OnDragOver(TreeViewItemEx tvItem, DragEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine($"DragOver: {tvItem.Item}");

            if (dropInfo != null && dropInfo.CouldHadleDrop(e))
            {
                dropInfo.UpdateInsertPosition(e);
                dropInfo.UpdateTargetCollectionAndIndex();
                if (dropInfo.CanAcceptData(DropInfo.ExtractDropData(dragInfo, e)))
                {
                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                    {
                        e.Effects = DragDropEffects.Copy;
                    }
                    else
                    {
                        e.Effects = DragDropEffects.Move;
                    }
                }
                else
                {
                    e.Effects = DragDropEffects.None;
                }
                dropInfo.Effects = e.Effects;
                e.Handled        = true;
            }
        }
Esempio n. 4
0
 public static void OnMouseDown(TreeViewItemEx tvItem, MouseButtonEventArgs e)
 {
     if (e.ButtonState == MouseButtonState.Pressed &&
         (e.ChangedButton == MouseButton.Left || e.ChangedButton == MouseButton.Right))
     {
         dragInfo = new DragInfo(tvItem, e);
     }
 }
Esempio n. 5
0
 public static void OnQueryContinueDrag(TreeViewItemEx tvItem, QueryContinueDragEventArgs e)
 {
     if (e.Action == DragAction.Cancel || e.EscapePressed)
     {
         Cancel();
         e.Handled = true;
     }
 }
Esempio n. 6
0
 public DragInfo(TreeViewItemEx directVisualSourceItem, MouseButtonEventArgs e)
 {
     DragStartPoint         = e.GetPosition(directVisualSourceItem);
     DragMouseButton        = e.ChangedButton;
     DirectVisualSourceItem = directVisualSourceItem;
     DirectSourceItem       = directVisualSourceItem.Item;
     VisualSource           = directVisualSourceItem.ParentTreeView;
 }
Esempio n. 7
0
 public static void OnDragLeave(TreeViewItemEx tvItem, DragEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine($"DragLeave: {tvItem.Item}");
     if (dropInfo != null)
     {
         dropInfo.TargetItem = null;
     }
 }
Esempio n. 8
0
        public static void HandleDropForTarget(TreeViewItemEx tvItem, DragEventArgs e)
        {
            OnDragOver(tvItem, e);
            if (dragInfo?.IsDragInProgress == true)
            {
                return;
            }

            HandleDropForTarget(e.Effects, e);
        }
Esempio n. 9
0
        public static void OnDragEnter(TreeViewItemEx tvItem, DragEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine($"DragEnter: {tvItem.Item}");

            if (dropInfo == null)
            {
                dropInfo = new DropInfo();
            }

            if (dropInfo.CouldHadleDrop(e))
            {
                dropInfo.TargetItem = tvItem;
                e.Handled           = true;
            }
            OnDragOver(tvItem, e);
        }
Esempio n. 10
0
        public static void OnDragEnter(TreeViewItemEx tvItem, DragEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine($"DragEnter: {tvItem.Item}");

            // this logic was moved to OnDragOver to fix an issue
            // when using drag and drop if the window is floating

            //if (dropInfo == null)
            //    dropInfo = new DropInfo();

            //if (dropInfo.CouldHadleDrop(e))
            //{
            //    dropInfo.TargetItem = tvItem;
            //    e.Handled = true;
            //}

            OnDragOver(tvItem, e);
        }
Esempio n. 11
0
        /// <summary>
        /// Generate NavGroup
        /// </summary>
        /// <param name="localizeItemSelector"></param>
        /// <param name="item"></param>
        private void SetNavBarGroup(LocalizeItemSelector localizeItemSelector, SystemMenuTreeList item)
        {
            NavGroup = new OutlookSection();
            //NavGroup.PageUri = item.PageUri;
            NavGroup.Header = localizeItemSelector.setLocalizeValue(NavGroup, HeaderedContentControl.HeaderProperty);
            if (item.ImageIcon != null)
            {
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.CreateOptions = BitmapCreateOptions.None;
                bitmap.CacheOption   = BitmapCacheOption.Default;
                var imageSource = item.ImageIcon;
                bitmap.StreamSource = new MemoryStream((byte[])imageSource.ToArray());
                bitmap.EndInit();
                Image image = new Image();
                image.Source   = bitmap;
                NavGroup.Image = image.Source;
            }
            //NavGroup.Click += NavGroup_Click;
            NavigationBar.Sections.Add(NavGroup);
            objtree          = new TreeView();
            NavGroup.Margin  = new Thickness(0, 0, 0, 0);
            objtree.Margin   = new Thickness(0, 5, 0, 0);
            NavGroup.Content = objtree;
            //NavigationBar.Items.Add(objtree);
            TreeViewItemEx AreapageItem = new TreeViewItemEx()
            {
                Style = objtemplate, IsAreaPageTreeItem = true
            };                                                                                                    //
            LocalizeItemSelector localizeItemSelector1 = new LocalizeItemSelector();

            CommonMethods.AddLocalizeItem(localizeItemSelector1, "en", "Area Page");
            CommonMethods.AddLocalizeItem(localizeItemSelector1, "ja", "エリアページ");
            CommonMethods.AddLocalizeItem(localizeItemSelector1, "th", "หน้าบริเวณ");
            CommonMethods.AddLocalizeItem(localizeItemSelector1, "zh", "區頁");
            //AreapageItem.PageUri = item.PageUri;
            localizeItemSelector1.setLocalizeValue(AreapageItem, TreeViewItemEx.HeaderProperty);
            AreapageItem.Header = localizeItemSelector1.setLocalizeValue(AreapageItem, TreeViewItemEx.HeaderProperty);
            //AreapageItem.MouseLeftButtonUp += new MouseButtonEventHandler(AreapageItem_MouseLeftButtonUp);
            objtree.Items.Add(AreapageItem);
        }
Esempio n. 12
0
        public static void OnDragOver(TreeViewItemEx tvItem, DragEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine($"DragOver: {tvItem.Item}");

            if (dropInfo == null)
            {
                dropInfo = new DropInfo();
            }

            if (dropInfo.CouldHadleDrop(e))
            {
                // set the target item, this also initializes the DropTargetAdorner
                dropInfo.TargetItem = tvItem;

                // update data related to the current mouse position and the target item
                dropInfo.UpdateInsertPosition(e);
                dropInfo.UpdateTargetContainerAndIndex();

                // set the drop mode Copy|Move|None
                if (dropInfo.CanAcceptData(DropInfo.ExtractDropData(dragInfo, e)))
                {
                    if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                    {
                        e.Effects = DragDropEffects.Copy;
                    }
                    else
                    {
                        e.Effects = DragDropEffects.Move;
                    }
                }
                else
                {
                    e.Effects = DragDropEffects.None;
                }

                // this controls the adorner
                dropInfo.Effects = e.Effects;

                e.Handled = true;
            }
        }
Esempio n. 13
0
 internal bool PreviewExpandTreeViewItem(TreeViewItemEx item)
 {
     // return true to allow expansion, false to cancel
     return(true);
 }