private static void OnViewModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FrameStudio fs = d as FrameStudio; if ((bool)e.NewValue) { fs.EditMode = false; fs.linksbutton.IsChecked = true; foreach (var item in (fs.DataContext as DiagramBuilderVM).Diagrams) { fs.settingpopup.IsOpen = false; if (fs.rulerVisiblitySwitch.IsOn) { fs._mRulerEnabledOnEditMode = true; } else { fs._mRulerEnabledOnEditMode = false; } (item.PageSettings as PageVM).Ruler = false; foreach (var node in item.NodeCollection) { node.IsSelected = false; node.Constraints = node.Constraints & ~NodeConstraints.Selectable; node.EditMode = false; fs.AvoidLabelEditinViewMode(node as INodeVM); } } } else { fs.EditMode = true; fs.linksbutton.IsChecked = false; if (fs._mRulerEnabledOnEditMode) { fs.rulerVisiblitySwitch.IsOn = true; } else { fs.rulerVisiblitySwitch.IsOn = false; } foreach (var item in (fs.DataContext as DiagramBuilderVM).Diagrams) { foreach (var node in item.NodeCollection) { node.Constraints = node.Constraints | NodeConstraints.Selectable; node.EditMode = true; } } } }
private static void OnEditModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FrameStudio fs = d as FrameStudio; if ((bool)e.NewValue) { fs.ViewMode = false; } else { fs.ViewMode = true; } }