예제 #1
0
        protected override void OnVisualAdded(UIElement elt)
        {
            if (elt is Viewport3D)
            {
                return;
            }

            int index = Children.IndexOf(elt);

            Viewport2DVisual3D model = CreateLoginViewPort(elt);
            //set binding
            LoginGrid loginGrid = (LoginGrid)model.Visual;

            loginGrid.DataContext = elt;
            //                        loginGrid.txtConnectionName.Text = ((ListBoxItem)loginGrid.DataContext).Content.ToString();
            loginGrid.imgMoveToLeft.MouseDown  += MoveToLeft;
            loginGrid.imgMoveToRight.MouseDown += MoveToRight;

            _modelContainer.Children.Insert(index, model);
            model.SetValue(LinkedElementProperty, elt);
            elt.SetValue(LinkedModelProperty, model);
            if (IsLoaded)
            {
                ReflowItems();
            }
            SelectedIndex = Children.Count - 1;
        }
예제 #2
0
        protected override void OnVisualAdded(UIElement elt)
        {
            if (elt is Viewport3D)
            {
                return;
            }

            int index = Children.IndexOf(elt);

            Viewport2DVisual3D model = CreateApplicationViewPort(elt);
            //set binding
            ApplicationGrid visual = (ApplicationGrid)model.Visual;

            visual.AllowDrop          = true;
            visual.DataContext        = elt;
            visual.DragEnter         += TabsElementFlow_DragEnter;
            visual.MouseEnter        += TabsElementFlow_MouseEnter;
            visual.MouseDown         += TabsElementFlow_MouseDown;
            visual.CloseButton.Click += CloseButtonClicked;
            _modelContainer.Children.Insert(index, model);
            model.SetValue(LinkedElementProperty, elt);
            elt.SetValue(LinkedModelProperty, model);
            if (IsLoaded)
            {
                ReflowItems();
            }
            SelectedIndex = Children.Count - 1;
        }