/// <summary> /// Method loads layout of Custom order properties data grid. /// </summary> private void _InitDataGridLayout() { // Get Data grid collection view source. DataGridCollectionViewSource gridCollectionViewSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(CUSTOM_ORDER_PROPERTIES_COLLECTION_SOURCE_KEY); // Bind collection of custom order properties to Xceed DataGrid. gridCollectionViewSource.Source = _customOrderProperties; //Grid structure file name. string gridStructureFileName = GridSettingsProvider.CustomOrderPropertiesGridStructure; // Grid structure initializer. GridStructureInitializer gridStructureInitializer = new GridStructureInitializer(gridStructureFileName); // Build structure of Xceed DataGrid. gridStructureInitializer.BuildGridStructure(gridCollectionViewSource, _customOrderPropertiesXceedGrid); // Grid settings repository name. string gridSettingsRepositoryName = GridSettingsProvider.CustomOrderPropertiesSettingsRepositoryName; // Grid layout loader. GridLayoutLoader gridLayoutLoader = new GridLayoutLoader(gridSettingsRepositoryName, gridCollectionViewSource.ItemProperties); // Load grid layout. gridLayoutLoader.LoadLayout(_customOrderPropertiesXceedGrid); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Method inits context of XceedGrid. /// </summary> private void _InitGUI() { if (!_isInited) { _collectionSource = (DataGridCollectionViewSource)layoutRoot.FindResource("messageTable"); GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.MessageWindowGridStructure); structureInitializer.BuildGridStructure(_collectionSource, xceedGrid); xceedGrid.DetailConfigurations.Clear(); xceedGrid.DetailConfigurations.Add((DetailConfiguration)layoutRoot.FindResource("messageDetailConfiguration")); // collaps all detail and reexpand it. List <DataGridContext> dataGridContexts = new List <DataGridContext>(xceedGrid.GetChildContexts()); foreach (DataGridContext dataGridContext in dataGridContexts) { dataGridContext.ParentDataGridContext.CollapseDetails(dataGridContext.ParentItem); dataGridContext.ParentDataGridContext.ExpandDetails(dataGridContext.ParentItem); } _collectionSource.Source = _data; _isInited = true; } }
/// <summary> /// Constructor. /// </summary> public FindOrdersView() { InitializeComponent(); // Create grid length for hided time range controls. _timeRangeHided = new GridLength(0, GridUnitType.Star); // Grid length for visible time range controls. _timeRangeShowed = LayoutRoot.RowDefinitions[RANGE_ITEM_ROW_INDEX].Height; // Prepare grid view. _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource("ordersCollection"); if (App.Current.Project != null) { GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.FindOrdersGridStructure); structureInitializer.BuildGridStructure(_collectionSource, DataGridControl); _collectionSource.Source = new Collection <Order>(); } App.Current.ProjectLoaded += new EventHandler(_ProjectLoaded); // Subscribe on mouse move for drag and drop. Application.Current.MainWindow.MouseMove += new MouseEventHandler(_MouseMove); UpdateLayout(); }
/// <summary> /// Method initializes grid layout. /// </summary> private void _InitDataGridLayout() { GridStructureInitializer structureInitializer = new GridStructureInitializer("ESRI.ArcLogistics.App.GridHelpers.ScheduleVersionsGridStructure.xaml"); structureInitializer.BuildGridStructure(_DataGridSource, XceedGrid); _isLayoutInitialized = true; }
/// <summary> /// Prepare data grid control to work. /// </summary> private void _InitDataGridControl() { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); // Initialize grid structure. GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.FleetGeocodableGridStructure); structureInitializer.BuildGridStructure(_collectionSource, DataGridControl); // Find index for first non-Name field to determine it as Address Field. int columnIndex = 0; for (int i = 0; i < DataGridControl.Columns.Count; i++) { if (DataGridControl.Columns[i].FieldName != NAME_COLUMN) { columnIndex = i; break; // Work done: first non-Name field found. } } // Set special content template to show "Add location" string. ColumnBase addressColumn = DataGridControl.Columns[columnIndex]; addressColumn.CellContentTemplate = (DataTemplate)App.Current.FindResource(ADDRESSLINE_CONTENT_TEMPLATE_NAME); CommonHelpers.HidePostalCode2Column(DataGridControl); // Load grid layout. GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.FleetLocationsSettingsRepositoryName, _collectionSource.ItemProperties); layoutLoader.LoadLayout(DataGridControl); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Loads grid layout. /// </summary> private void _InitDataGridLayout() { xceedGrid.OnItemSourceChanged += new EventHandler(xceedGrid_OnItemSourceChanged); DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)layoutRoot.FindResource(COLLECTION_SOURCE_KEY); GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.FleetRoutesGridStructure); structureInitializer.BuildGridStructure(collectionSource, xceedGrid); }
/// <summary> /// Init grid structure for Grid. /// </summary> /// <param name="gridStructure">Structure of the grid.</param> /// <param name="gridSettingsRepositoryName">Repository with grid settings.</param> /// <param name="grid">Grid.</param> /// <param name="collectionSource">Grid's collection source.</param> private void _InitGridStructure(string gridStructure, string gridSettingsRepositoryName, DataGridControlEx grid, DataGridCollectionViewSource collectionSource) { // Initializing gridstructure and gridlayout. GridStructureInitializer structureInitializer = new GridStructureInitializer (gridStructure); structureInitializer.BuildGridStructure(collectionSource, grid); GridLayoutLoader layoutLoader = new GridLayoutLoader(gridSettingsRepositoryName, collectionSource.ItemProperties); layoutLoader.LoadLayout(grid); }
private void _InitDataGridLayout() { DataGridCollectionViewSource fuelsCollection = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.FuelTypesGridStructure); structureInitializer.BuildGridStructure(fuelsCollection, XceedGrid); // load grid layout GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.FuelTypesSettingsRepositoryName, fuelsCollection.ItemProperties); layoutLoader.LoadLayout(XceedGrid); _isDataGridLayoutLoaded = true; }
/// <summary> /// Method inits all xceed data grid controls (sets collection source and columns structure foreach of them). /// </summary> private void _InitGridControl() { _isNewItemCreated = false; _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(ORDERS_COLLECTION_SOURCE_NAME); GridStructureInitializer initializer = new GridStructureInitializer(GridSettingsProvider.OrdersGridStructure); initializer.BuildGridStructure(_collectionSource, OrdersGrid); // load grid layout GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.OrdersSettingsRepositoryName, _collectionSource.ItemProperties); layoutLoader.LoadLayout(OrdersGrid); }
protected void _InitDataGridLayout() { DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.DriversGridStructure); structureInitializer.BuildGridStructure(collectionSource, XceedGrid); // load grid layout GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.DriversSettingsRepositoryName, collectionSource.ItemProperties); layoutLoader.LoadLayout(XceedGrid); _isDataGridLayoutLoaded = true; }
/// <summary> /// Inits data grid layout /// </summary> protected void _InitDataGridLayout() { DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); Debug.Assert(!string.IsNullOrEmpty(GridStructureName)); GridStructureInitializer gridStructureInitializer = new GridStructureInitializer(GridStructureName); gridStructureInitializer.BuildGridStructure(collectionSource, XceedGrid); // load grid layout Debug.Assert(!string.IsNullOrEmpty(SettingsRepositoryName)); GridLayoutLoader vehicleLayoutLoader = new GridLayoutLoader(SettingsRepositoryName, collectionSource.ItemProperties); vehicleLayoutLoader.LoadLayout(XceedGrid); _isDataGridLayoutLoaded = true; }
/// <summary> /// Loads grid layout. /// </summary> private void _InitDataGridLayout() { if (_collectionSource == null) { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); } GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.ZonesGridStructure); structureInitializer.BuildGridStructure(_collectionSource, XceedGrid); // Load grid layout. GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.ZonesSettingsRepositoryName, _collectionSource.ItemProperties); layoutLoader.LoadLayout(XceedGrid); _isDataGridLayoutLoaded = true; }
/// <summary> /// Method inits collection of projects. /// </summary> private void _InitProjectsCollection() { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource("projectSource"); GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.ProjectsGridStructure); structureInitializer.BuildGridStructure(_collectionSource, XceedGrid); XceedGrid.Columns[IS_CURRENT_COLUMN_CAPTION].CellEditor = (CellEditor)LayoutRoot.FindResource("ProjectsRadioButtonEditor"); XceedGrid.Columns[IS_CURRENT_COLUMN_CAPTION].CellContentTemplate = (DataTemplate)LayoutRoot.FindResource("RadioButtonTemplate"); XceedGrid.Columns[IS_CURRENT_COLUMN_CAPTION].CellEditorDisplayConditions = CellEditorDisplayConditions.Always; XceedGrid.Columns[NAME_COLUMN_CAPTION].CellValidationRules.Add(new ProjectNameValidationRule()); _BuildProjectsWrapperCollection(); _UpdateProjectsCheckboxes(); _collectionSource.Source = _projectsDataCollection; _isInited = true; }
/// <summary> /// Loads grid layout. /// </summary> private void _InitDataGridLayout() { if (_collectionSource == null) { _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); } var structureInitializer = new GridStructureInitializer(GridSettingsProvider.BarriersGridStructure); structureInitializer.BuildGridStructure(_collectionSource, XceedGrid); // load grid layout var layoutLoader = new GridLayoutLoader(GridSettingsProvider.BarriersSettingsRepositoryName, _collectionSource.ItemProperties); layoutLoader.LoadLayout(XceedGrid); // Find geometry field and... foreach (Column column in XceedGrid.Columns) { if (column.FieldName == GEOMETRY_FIELD_NAME) { // ...set field width to default one, // to let users know about this fields is exists. ColumnBase geometryColumn = XceedGrid.Columns[GEOMETRY_FIELD_NAME]; if (geometryColumn.Width == 0) { geometryColumn.Width = DEFAULT_COLUMN_WIDTH; } break; // Work done. } } _isLayoutLoaded = true; }
/// <summary> /// Method loads grid layout /// </summary> private void _InitCategoriesDataGridLayout() { DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource("categoryCollection"); collectionSource.Source = SymbologyManager.OrderCategories; GridStructureInitializer structureInitializer = new GridStructureInitializer("ESRI.ArcLogistics.App.GridHelpers.CategorySymbologyGridStructure.xaml"); structureInitializer.BuildGridStructure(collectionSource, CategoryXceedGrid); // load grid layout GridLayoutLoader layoutLoader = new GridLayoutLoader("CategoriesGridSettings", collectionSource.ItemProperties); layoutLoader.LoadLayout(CategoryXceedGrid); CategoryValidationRule valueValidationRule = new CategoryValidationRule(); CategoryXceedGrid.Columns[VALUE_COLUMN_INDEX].CellValidationRules.Add(valueValidationRule); }
/// <summary> /// Inits page GUI elements. /// </summary> protected void _InitPageContent() { App.Current.MainWindow.StatusBar.SetStatus(this, null); if (!_isLoaded) { _viewSourceReports = (DataGridCollectionViewSource)mainGrid.FindResource("reportsTable"); GridStructureInitializer structureInitializer = new GridStructureInitializer(GRID_STRUCTURE_REPORT_PREFERENCES); structureInitializer.BuildGridStructure(_viewSourceReports, xceedGridReports); ColumnBase columnName = xceedGridReports.Columns["Name"]; columnName.ReadOnly = false; columnName.CellValidationRules.Add(new ReportTemplateValidationRule()); xceedGridReports.OnItemSourceChanged += new EventHandler(_OnItemSourceChanged); _InitReportTable(); _isLoaded = true; } }
/// <summary> /// React on page loaded. /// </summary> /// <param name="sender">Ignored.</param> /// <param name="e">Ignored.</param> private void _FleetSetupWizardUngeocodedOrdersPageLoaded(object sender, RoutedEventArgs e) { // Init page if not inited yet. if (!_inited) { _isParentFleetWizard = DataKeeper != null; // Set row height. ContentGrid.RowDefinitions[DATA_GRID_ROW_DEFINITION_INDEX].Height = new System.Windows.GridLength(DEFAULT_ROW_HEIGHT * ROW_COUNT + DataGridControl.Margin.Top + DataGridControl.Margin.Bottom + ROW_COUNT); // Create subpages. string typeName = (string)App.Current.FindResource(ORDER_RESOURCE_NAME); typeName = typeName.ToLower(); _matchFoundSubPage = new MatchFoundSubPage(typeName); _candidatesNotFoundSubPage = new CandidatesNotFoundSubPage(typeName); _candidatesFoundSubPage = new CandidatesFoundSubPage(typeName); _SetSubPage(null); // Init orders collection. _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); _CreateOrdersLayer(); // Create and init geocodable page. _geocodablePage = new GeocodablePage(typeof(Order), mapCtrl, candidateSelect, controlsGrid, DataGridControl, splitter, _ordersLayer); _geocodablePage.MatchFound += new EventHandler(_MatchFound); _geocodablePage.CandidatesFound += new EventHandler(_CandidatesFound); _geocodablePage.CandidatesNotFound += new EventHandler(_CandidatesNotFound); // Datakeeper is not null in fleetwizard. _geocodablePage.ParentIsFleetWisard = _isParentFleetWizard; mapCtrl.AddTool(new EditingTool(), null); _collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY); GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.FleetGeocodableGridStructure); structureInitializer.BuildGridStructure(_collectionSource, DataGridControl); CommonHelpers.HidePostalCode2Column(DataGridControl); // Load grid layout. GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.FleetLocationsSettingsRepositoryName, _collectionSource.ItemProperties); layoutLoader.LoadLayout(DataGridControl); if (!_isParentFleetWizard) { _RemoveRedundantElements(); } _inited = true; } // Get orders collection from datakeeper if it is not null. Otherwise - from current project. if (_isParentFleetWizard) { // Fill ungeocoded orders list. _FillUngeocodedOrders(DataKeeper.AddedOrders); } else { // Do nothing. Ungeocoded order already set by constructor. } _collectionSource.Source = _ungeocodedOrders; _ordersLayer.Collection = _ungeocodedOrders; _selectionBinding.UnregisterAllCollections(); _selectionBinding.RegisterCollection(DataGridControl); _selectionBinding.RegisterCollection(mapCtrl.SelectedItems); ButtonFinish.IsEnabled = _IsFinishButtonEnabled(_ungeocodedOrders); }
/// <summary> /// Create new grid structure, using current project settings. /// </summary> /// <param name="sender">Ignored.</param> /// <param name="e">Ignored.</param> private void _ProjectLoaded(object sender, EventArgs e) { GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.FindOrdersGridStructure); structureInitializer.BuildGridStructure(_collectionSource, DataGridControl); }