private static void PartPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //((Part3D)d).InvalidateModel(); Part3D p = d as Part3D; if (p != null) { p.Content = p.CreatePartModel(); } }
private static void IsSelectedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Part3D s = (Part3D)d; s.IsSelected = (bool)e.NewValue; s.ChangeApperence(s.IsSelected ? PartStatus.Selected : PartStatus.None); //s.RaiseEvent(SelectionChangedEvent); }
private static void ShowLinesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Part3D s = (Part3D)d; if (s == null) { return; } if ((bool)e.NewValue) { s.Children.Add(s._edges); } else { s.Children.Clear(); } }
private static void ColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Part3D s = (Part3D)d; if (s.Visual3DModel == null) { return; } s.PartColor = (PartColors)e.NewValue; Model3DGroup mg = (Model3DGroup)s.Visual3DModel; DiffuseMaterial mat = ((GeometryModel3D)mg.Children[0]).Material as DiffuseMaterial; s._partColor = KnownPartColors.GetColor(s.PartColor); if (mat != null) { mat.Brush = s._partColor.Color; } }
private static void PositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Part3D s = (Part3D)d; s.Position = (Point3D)e.NewValue; TranslateTransform3D trans = s.Transform as TranslateTransform3D; if (trans != null) { trans.OffsetX = s.Position.X; trans.OffsetY = s.Position.Y; trans.OffsetZ = s.Position.Z; } else { s.Transform = null; s.Transform = new TranslateTransform3D(s.Position.X, s.Position.Y, s.Position.Z); } // DO NOT RAISE THIS EVENT HERE. //s.RaiseEvent(PositionChangedEvent); }