Beispiel #1
0
 public TemplateView()
 {
     InitializeComponent();
     DataContext = TemplateViewModelLocator.GetTemplateVM();
     PropertyTreeListView.DataContext            = PropertyViewModelLocator.GetPropertyVM();
     RequirementTreeListView.DataContext         = RequirementViewModelLocator.GetRequirementVM();
     TemplateAssociationTreeListView.DataContext = TemplateAssociationViewModelLocator.GetTemplateAssociationVM();
     TemplateRequirementTreeListView.DataContext = TemplateRequirementViewModelLocator.GetTemplateRequirementVM();
 }
Beispiel #2
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     // Link View Models to the Trees and popups
     DataContext = ObjectViewModelLocator.GetObjectVM();
     TemplateTreeListView.DataContext          = TemplateViewModelLocator.GetTemplateVM();
     PropertyTreeListView.DataContext          = PropertyViewModelLocator.GetPropertyVM();
     RequirementTreeListView.DataContext       = RequirementViewModelLocator.GetRequirementVM();
     ObjectAssociationTreeListView.DataContext = ObjectAssociationViewModelLocator.GetObjectAssociationVM();
     ObjectRequirementTreeListView.DataContext = ObjectRequirementViewModelLocator.GetObjectRequirementVM();
 }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            DataContext = RequirementViewModelLocator.GetRequirementVM();
            // Link the RichTextBoxRibbon to the commands defined in the RichTextBox control, part of the Telerik library
            radRichTextBoxRibbonUI.DataContext = radRichTextBox.Commands;

            IColumnFilterDescriptor DeletedRequirementFilter = this.RequirementTreeListView.Columns["IsDeleted"].ColumnFilterDescriptor;

            DeletedRequirementFilter.FieldFilter.Filter1.Operator = FilterOperator.IsEqualTo;
            DeletedRequirementFilter.FieldFilter.Filter1.Value    = "False";
        }
        //TODO: fix hard code
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            if (e.Data != null && e.AllowedEffects != DragDropEffects.None)
            {
                var             treeListViewName = (sender as RadTreeListView).Name;
                TreeListViewRow destination      = e.OriginalSource as TreeListViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <TreeListViewRow>();
                switch (treeListViewName)
                {
                case "ObjectTreeListView":
                    ObjectViewModelLocator.GetObjectVM().MoveSelection(destination);
                    break;

                case "TemplateTreeListView":
                    TemplateViewModelLocator.GetTemplateVM().MoveSelection(destination);
                    break;

                case "PropertyTreeListView":
                    PropertyViewModelLocator.GetPropertyVM().MoveSelection(destination);
                    break;

                case "ObjectAssociationTreeListView":
                    ObjectAssociationViewModel objectAssociationViewModel = ObjectAssociationViewModelLocator.GetObjectAssociationVM();
                    objectAssociationViewModel.AssociateWithObject(destination);
                    objectAssociationViewModel.FilteredObjectAssociations.View.Refresh();
                    break;

                case "ObjectRequirementTreeListView":
                    ObjectRequirementViewModel objectRequirementViewModel = ObjectRequirementViewModelLocator.GetObjectRequirementVM();
                    objectRequirementViewModel.AssociateWithObject(destination);
                    objectRequirementViewModel.FilteredObjectRequirements.View.Refresh();
                    break;

                case "TemplateAssociationTreeListView":
                    TemplateAssociationViewModel templateAssociationViewModel = TemplateAssociationViewModelLocator.GetTemplateAssociationVM();
                    templateAssociationViewModel.AssociateWithTemplate(destination);
                    templateAssociationViewModel.FilteredTemplateAssociations.View.Refresh();
                    break;

                case "TemplateRequirementTreeListView":
                    TemplateRequirementViewModel templateRequirementViewModel = TemplateRequirementViewModelLocator.GetTemplateRequirementVM();
                    templateRequirementViewModel.AssociateWithTemplate(destination);
                    templateRequirementViewModel.FilteredTemplateRequirements.View.Refresh();
                    break;

                case "RequirementTreeListView":
                    RequirementViewModelLocator.GetRequirementVM().MoveSelection(destination);
                    break;
                }
            }
        }
        private void ContextMenu_Loaded(object sender, RoutedEventArgs e)
        {
            (sender as RadContextMenu).DataContext = RequirementViewModelLocator.GetRequirementVM();

            //(sender as RadContextMenu).ItemsSource = ObjectViewModelLocator.GetObjects().ObjectTypes;
        }