示例#1
0
        private void ClearModel(FrameworkElement elt, object item)
        {
            ModelUIElement3D model = elt.GetValue(LinkedModelProperty) as ModelUIElement3D;

            _modelContainer.Children.Remove(model);

            // Update the positions of all model items
            int removed = (int)model.GetValue(LinkedElementPositionProperty);

            foreach (Visual3D m in _modelContainer.Children)
            {
                int val = (int)m.GetValue(LinkedElementPositionProperty);
                if (val > removed)
                {
                    m.SetValue(LinkedElementPositionProperty, val - 1);
                }
            }

            model.ClearValue(LinkedElementProperty);
            elt.ClearValue(LinkedModelProperty);

            // Update SelectedIndex if needed
            if (SelectedIndex >= 0 && SelectedIndex < Items.Count)
            {
                ReflowItems();
            }
            else
            {
                SelectedIndex = Math.Max(0, Math.Min(SelectedIndex, Items.Count - 1));
            }
        }
示例#2
0
        public HitTestFilterBehavior MyHitTestFilter(DependencyObject o)
        {
            if (o.GetType() == typeof(Viewport3DVisual))
            {
                return(HitTestFilterBehavior.Continue);
            }
            else if (o.GetType() == typeof(ModelUIElement3D))
            {
                ModelUIElement3D j = (ModelUIElement3D)o;
                bool             d = (bool)j.GetValue(UIElement3D.IsHitTestVisibleProperty);

                if (d == false)
                {
                    return(HitTestFilterBehavior.ContinueSkipSelfAndChildren);
                }
                else
                {
                    return(HitTestFilterBehavior.Continue);
                }
            }
            else
            {
                return(HitTestFilterBehavior.ContinueSkipSelf);
            }
        }
示例#3
0
 private void model_MouseEnter(object sender, MouseEventArgs e)
 {
     if (SelectedIndex == _modelContainer.Children.IndexOf((Visual3D)sender))
     {
         ModelUIElement3D newSelectedModel = (ModelUIElement3D)_modelContainer.Children[SelectedIndex];
         ListBoxItem      item             = (ListBoxItem)newSelectedModel.GetValue(LinkedElementProperty);
         RaiseCurrentElementMouseEnterEvent((Tab)item.Content);
     }
 }
示例#4
0
        private void OnContainerLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Focus();

            ModelUIElement3D model = e.Source as ModelUIElement3D;

            if (model != null)
            {
                //SelectedIndex = _modelContainer.Children.IndexOf(model);
                SelectedIndex = (int)model.GetValue(LinkedElementPositionProperty);
            }
        }