Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        /// <summary>
        /// create application element
        /// </summary>
        /// <param name="visualBrush"></param>
        /// <returns></returns>
        protected Viewport2DVisual3D CreateApplicationViewPort(UIElement visualBrush)
        {
            VisualBrush        brush = new VisualBrush(visualBrush);
            Viewport2DVisual3D view  =
                Application.LoadComponent(
                    new Uri("/RoDuino.SMS;component/Components/RoApplicationMenu/Viewport2DVisual3D.xaml",
                            UriKind.Relative)) as
                Viewport2DVisual3D;

            ((MeshGeometry3D)view.Geometry).Positions = CreateMeshPositions();
            ApplicationGrid visual = new ApplicationGrid();

            visual.borderBrush.Background = brush;

            view.Visual = visual;

            return(view);
        }
Exemplo n.º 3
0
        /// <summary>
        /// create application element
        /// </summary>
        /// <param name="visualBrush"></param>
        /// <returns></returns>
        protected Viewport2DVisual3D CreateApplicationViewPort(UIElement visualBrush)
        {
            VisualBrush brush = new VisualBrush(visualBrush);
            Viewport2DVisual3D view =
                Application.LoadComponent(
                    new Uri("/RoDuino.SMS;component/Components/RoApplicationMenu/Viewport2DVisual3D.xaml",
                            UriKind.Relative)) as
                Viewport2DVisual3D;
            ((MeshGeometry3D)view.Geometry).Positions = CreateMeshPositions();
            ApplicationGrid visual = new ApplicationGrid();
            visual.borderBrush.Background = brush;

            view.Visual = visual;

            return view;
        }