void FileButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { FileButton f = sender as FileButton; if (f.Tag != null) { DiagramFrontPage fp = f.Tag as DiagramFrontPage; (fp.DataContext as DiagramCommonViewModel).ItemClick.Execute(this.DataContext as FileItem); } }
private static void OnUMLViewModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DiagramFrontPage front = d as DiagramFrontPage; if (e.OldValue != null) { DiagramCommonViewModel oldValue = e.OldValue as DiagramCommonViewModel; oldValue.ExportFiles = null; oldValue.ImportFiles = null; oldValue.DeleteFiles = null; oldValue.SelectAll = null; oldValue.ClearSelection = null; oldValue.RenameFile = null; oldValue.PropertyChanged -= (d as DiagramFrontPage).FrontPage_PropertyChanged; } if (e.NewValue == null) { return; } //if (front.DiagramType == DiagramType.UML) //{ (e.NewValue as DiagramCommonViewModel).PropertyChanged += (d as DiagramFrontPage).FrontPage_PropertyChanged; //} //else if (front.DiagramType == DiagramType.WorkFlow) //{ // (e.NewValue as WorkFlowEditor.ProcessAutomationViewModel).PropertyChanged += (d as DiagramFrontPage).FrontPage_PropertyChanged; //} front.DiagramCommonViewModel.ExportFiles = new DelegateCommand <object>(front.OnExport, front.CanExport); front.DiagramCommonViewModel.ImportFiles = new DelegateCommand <object>(front.OnImport); front.DiagramCommonViewModel.DeleteFiles = new DelegateCommand <object>(front.OnDeleteFiles); front.DiagramCommonViewModel.SelectAll = new DelegateCommand <object>(front.OnSelectAll); front.DiagramCommonViewModel.ClearSelection = new DelegateCommand <object>(front.OnClearSelection); front.DiagramCommonViewModel.RenameFile = new DelegateCommand <object>(front.OnRename, front.CanRename); front.DiagramCommonViewModel.ItemClick = new DelegateCommand <object>(front.ItemClicked); }