private void c1gridContextMenuOpening(object sender, ContextMenuEventArgs e, C1DataGrid gridname) { DependencyObject dobj = (DependencyObject)e.OriginalSource; dobj = VisualTreeHelper.GetParent(dobj); dobj = VisualTreeHelper.GetParent(dobj); dobj = VisualTreeHelper.GetParent(dobj); if (dobj.DependencyObjectType.Name.Equals("DataGridRowHeaderPresenter") || dobj.DependencyObjectType.Name.Equals("DataGridRowsHeaderPanel")) { e.Handled = false; foreach (var item in gridname.Rows) { if (item.IsMouseOver) { gridname.SelectedIndex = item.Index; break; } } } else { e.Handled = true; return; } }
public ActivityFinderPopupViewModel(BcontrolDataHandler datahandler,C1DataGrid searchGrid) { eventaggregator = EventAggregator.Instance; IsVisible = false; _datahandler = datahandler; _datahandler.SearchInitialDataRetrieved += new EventHandler<GetSearchInitialDataCompletedEventArgs>(bcontrolDataHandler_SearchInitialDataRetrieved); _datahandler.SearchByMapListRetrieved +=new EventHandler<GetSearchMapListCompletedEventArgs>(bcontrolDatahandler_SearchByMapListRetrieved); _datahandler.SearchByGlobalHeadListRetrieved += new EventHandler<GetSearchGlobalHeadListCompletedEventArgs>(bcontrolDatahandler_SearchByGlobalHeadListRetrieved); _datahandler.SearchByGlobalFunctionListRetrieved += new EventHandler<GetSearchGlobalFunctionListCompletedEventArgs>(bcontrolDatahandler_SearchByGlobalFunctionListRetrieved); _datahandler.SearchByBusinessAreaListRetrieved += new EventHandler<GetSearchBusinessAreaListCompletedEventArgs>(bcontrolDatahandler_SearchByBusinessAreaListRetrieved); _datahandler.SearchByBusinessFunctionListRetrieved += new EventHandler<GetSearchBusinessFunctionListCompletedEventArgs>(bcontrolDatahandler_SearchByBusinessFunctionListRetrieved); _datahandler.SearchBySubFunctionListRetrieved += new EventHandler<GetSearchSubFunctionListCompletedEventArgs>(bcontrolDatahandler_SearchByBusinessSubFunctionListRetrieved); _datahandler.SearchByLevelDataRetrieved += new EventHandler<GetSearchResultsBylevelCompletedEventArgs>(bcontrolDataHandler_SearchByLevelDataRetrieved); _datahandler.SearchByHierarchyDataRetrieved += new EventHandler<GetSearchResultsByHierarchyCompletedEventArgs>(bcontrolDataHandler_SearchByHierarchyDataRetrieved); _datahandler.DiagramTemplateLinkRetrieved += new EventHandler<GetDiagramTemplateLinkCompletedEventArgs>(bcontrolDataHandler_DiagramTemplateLinkRetrieved); _datahandler.ExisitingActivitiesRetrieved +=new EventHandler<GetExisitingActivitiesCompletedEventArgs>(bcontrolDatahandler_ExisitingActivitiesRetrieved); _isModifiedLinks = false; _searchResultsList = new ObservableCollection<ActivitySet>(); _datahandler.GetDiagramTemplateLink(); ErrorMessage = ""; _searchGrid = searchGrid; }
public override bool GoToRightCell(DataGridCell currentCell, bool shift, bool ctrl) { if (currentCell != null) { C1DataGrid dataGrid = currentCell.DataGrid; DataGridRow selectedRow = currentCell.Row; switch (selectedRow.Type) { case DataGridRowType.New: case DataGridRowType.Item: var column = GetNextVisibleColumn(currentCell.Column); if (column == null) { var row = GetNextVisibleRow(currentCell.Row); if (row != null) { if (row.DataGrid != currentCell.DataGrid) { row.DataGrid.Focus(); return(SetCurrentCell(row.DataGrid[row, GetLeftMostVisibleColumn(row.DataGrid)], shift, ctrl)); } else { return(SetCurrentCell(dataGrid[row, GetLeftMostVisibleColumn(dataGrid)], shift, ctrl)); } } } break; } } return(base.GoToRightCell(currentCell, shift, ctrl)); }
public UploadReportHierarchyViewModel(StringBuilder log, C1DataGrid grid, BcontrolDataHandler bcontrolDataHandler) { eventaggregator = EventAggregator.Instance; _log = log; _grid = grid; PreviewCommand = new RelayCommand(PreviewAction); PreviewCommand.IsEnabled = false; UploadCommand = new RelayCommand(UploadAction); UploadCommand.IsEnabled = false; CloseCommand = new RelayCommand(CloseAction); CloseCommand.IsEnabled = true; _datahandler = bcontrolDataHandler; _datahandler.ClearBcontrolHierarchyDataRetrieved += new EventHandler<ClearBcontrolHierarchyDataCompletedEventArgs>(_datahandler_ClearBcontrolHierarchyDataRetrieved); _datahandler.AddBcontrolHierarchyDataRetrieved += new EventHandler<AddBcontrolHierarchyDataCompletedEventArgs>(_datahandler_AddBcontrolHierarchyDataRetrieved); _datahandler.CompleteAddBcontrolHierarchyDataRetrieved += new EventHandler<CompleteAddBcontrolHierarchyDataCompletedEventArgs>(_datahandler_CompleteAddBcontrolHierarchyDataRetrieved); _columns = new Dictionary<string, ReportField>(); _columns.Add("Map Name", new ReportField(100, true)); _columns.Add("Level", new ReportField(500, true)); _columns.Add("FunctionalHead", new ReportField(50, false)); _columns.Add("AdditionalData", new ReportField(100, false)); _columns.Add("TOM", new ReportField(100, false)); _columns.Add("REN", new ReportField(100, false)); _columns.Add("Bcontrol Function Structure", new ReportField(100, false)); _columns.Add("Taxonomy Level 3", new ReportField(100, false)); _columns.Add("BusinessHierarchy1", new ReportField(100, false)); _columns.Add("BusinessHierarchy2", new ReportField(100, false)); _columns.Add("BusinessHierarchy3", new ReportField(100, false)); }
public override bool SetCurrentCell(DataGridCell cell, bool shift, bool ctrl) { if (cell != null) { C1DataGrid dataGrid = cell.DataGrid; dataGrid.CurrentCell = cell; dataGrid.Selection.BeginUpdate(); dataGrid.Selection.Clear(); dataGrid.Selection.Add(cell, cell); dataGrid.Selection.EndUpdate(); while (true) { if (cell.DataGrid == dataGrid) { dataGrid.ScrollIntoView(); } else { dataGrid.ScrollIntoView(cell.Presenter); } var row = GetParentRow(dataGrid); if (row != null) { dataGrid = row.DataGrid; } else { break; } } return(true); } return(false); }
internal void InitializeComponent(BcontrolDataHandler dataHandler, C1DataGrid searchGrid) { ViewModelLocator vmlocator = new ViewModelLocator(); object[] args = new object[] { dataHandler, searchGrid }; ActivityFinderPopupViewModel vm = (ActivityFinderPopupViewModel)vmlocator.GetViewModel(typeof(ActivityFinderPopupViewModel), true, args); this.DataContext = vm; }
private static void SelectionChanged(C1DataGrid dataGrid) { var parentRow = dataGrid.Tag as DataGridRow; if (parentRow != null) { parentRow.DataGrid.Selection.Clear(); } }
public static void ExportToExcel(C1DataGrid grid) { SaveFileDialog objSFD = new SaveFileDialog() { DefaultExt = "xls", Filter = "Excel Files (*.xls)|*.xls|All files (*.*)|*.*", FilterIndex = 1 }; if (objSFD.ShowDialog() == true) { ExportDataGrid(grid, objSFD); } }
public C1DataGrid GetRootGrid(C1DataGrid dataGrid) { var rootGrid = dataGrid; while (true) { var row = GetParentRow(rootGrid); if (row != null) { rootGrid = row.DataGrid; } else { break; } } return(rootGrid); }
public DataGridRow GetParentRow(C1DataGrid dataGrid) { return(dataGrid.Tag as DataGridRow); }
int _selStart, _selLength; // selection within cell #endregion Fields #region Constructors public DataGridSpellWrapper(C1DataGrid grid) { _grid = grid; _cols = new List<C1.WPF.DataGrid.DataGridTextColumn>(); Initialize(); }
public void SelectionChanged_ActivityLinks(object sender, DataGridSelectionChangedEventArgs e) { ErrorMessage = string.Empty; _linkGrid = (C1DataGrid)sender; SelectedRemoveRow = null; if (e.AddedRanges.Rows != null) { foreach (DataGridRow r in e.AddedRanges.Rows) { if (r.DataItem != null) SelectedRemoveRow = (ActivitySet)r.DataItem; } } }
private void renumberRowHeader(C1DataGrid c1grid)//for refresh row header numbers on add/delete. { ///// renumbering//////// if (c1grid.Viewport != null) { foreach (var row in c1grid.Viewport.Rows) { if (row.Index != -1 && row != null) UpdateRow(row); } } }
static void ExportDataGrid(C1DataGrid dGrid, SaveFileDialog objSFD) { string strFormat = objSFD.SafeFileName.Substring(objSFD.SafeFileName.IndexOf('.') + 1).ToUpper(); StringBuilder strBuilder = new StringBuilder(); if (dGrid.ItemsSource == null) return; List<string> lstFields = new List<string>(); if (dGrid.HeadersVisibility == C1.Silverlight.DataGrid.DataGridHeadersVisibility.Column || dGrid.HeadersVisibility == C1.Silverlight.DataGrid.DataGridHeadersVisibility.All) { foreach (C1.Silverlight.DataGrid.DataGridColumn dgcol in dGrid.Columns) lstFields.Add(FormatField(dgcol.Header.ToString().ToUpper(), strFormat)); BuildStringOfRow(strBuilder, lstFields, strFormat); } if (dGrid.ItemsSource is PagedCollectionView) { foreach (object data in (dGrid.ItemsSource as PagedCollectionView).SourceCollection) { lstFields.Clear(); foreach (C1.Silverlight.DataGrid.DataGridColumn col in dGrid.Columns) { string strValue = ""; Binding objBinding = null; if (col is C1.Silverlight.DataGrid.DataGridBoundColumn) objBinding = (col as C1.Silverlight.DataGrid.DataGridBoundColumn).Binding; if (col is C1.Silverlight.DataGrid.DataGridTemplateColumn) { //This is a template column... // let us see the underlying dependency object DependencyObject objDO = (col as C1.Silverlight.DataGrid.DataGridTemplateColumn).CellTemplate.LoadContent(); FrameworkElement oFE = (FrameworkElement)objDO; FieldInfo oFI = oFE.GetType().GetField("TextProperty"); if (oFI != null) { if (oFI.GetValue(null) != null) { if (oFE.GetBindingExpression( (DependencyProperty)oFI.GetValue(null)) != null) objBinding = oFE.GetBindingExpression( (DependencyProperty)oFI.GetValue(null)).ParentBinding; } } } if (objBinding != null) { if (objBinding.Path.Path != "") { PropertyInfo pi = data.GetType().GetProperty(objBinding.Path.Path); if (pi != null) strValue = pi.GetValue(data, null).ToString(); } if (objBinding.Converter != null) { if (strValue != "") strValue = objBinding.Converter.Convert(strValue, typeof(string), objBinding.ConverterParameter, objBinding.ConverterCulture).ToString(); else strValue = objBinding.Converter.Convert(data, typeof(string), objBinding.ConverterParameter, objBinding.ConverterCulture).ToString(); } } lstFields.Add(FormatField(strValue, strFormat)); } BuildStringOfRow(strBuilder, lstFields, strFormat); } } else { foreach (object data in dGrid.ItemsSource) { lstFields.Clear(); foreach (C1.Silverlight.DataGrid.DataGridColumn col in dGrid.Columns) { string strValue = ""; Binding objBinding = null; if (col is C1.Silverlight.DataGrid.DataGridBoundColumn) objBinding = (col as C1.Silverlight.DataGrid.DataGridBoundColumn).Binding; if (col is C1.Silverlight.DataGrid.DataGridTemplateColumn) { //This is a template column... // let us see the underlying dependency object DependencyObject objDO = (col as C1.Silverlight.DataGrid.DataGridTemplateColumn).CellTemplate.LoadContent(); FrameworkElement oFE = (FrameworkElement)objDO; FieldInfo oFI = oFE.GetType().GetField("TextProperty"); if (oFI != null) { if (oFI.GetValue(null) != null) { if (oFE.GetBindingExpression( (DependencyProperty)oFI.GetValue(null)) != null) objBinding = oFE.GetBindingExpression( (DependencyProperty)oFI.GetValue(null)).ParentBinding; } } } if (objBinding != null) { if (objBinding.Path.Path != "") { PropertyInfo pi = data.GetType().GetProperty(objBinding.Path.Path); if (pi != null) strValue = pi.GetValue(data, null).ToString(); } if (objBinding.Converter != null) { if (strValue != "") strValue = objBinding.Converter.Convert(strValue, typeof(string), objBinding.ConverterParameter, objBinding.ConverterCulture).ToString(); else strValue = objBinding.Converter.Convert(data, typeof(string), objBinding.ConverterParameter, objBinding.ConverterCulture).ToString(); } } lstFields.Add(FormatField(strValue, strFormat)); } BuildStringOfRow(strBuilder, lstFields, strFormat); } } StreamWriter sw = new StreamWriter(objSFD.OpenFile()); if (strFormat == "XLS") { //Let us write the headers for the Excel XML sw.WriteLine("<?xml version=\"1.0\" " + "encoding=\"utf-8\"?>"); sw.WriteLine("<?mso-application progid" + "=\"Excel.Sheet\"?>"); sw.WriteLine("<Workbook xmlns=\"urn:" + "schemas-microsoft-com:office:spreadsheet\">"); sw.WriteLine("<DocumentProperties " + "xmlns=\"urn:schemas-microsoft-com:" + "office:office\">"); sw.WriteLine("<Author></Author>"); sw.WriteLine("<Created>" + DateTime.UtcNow.ToLocalTime().ToLongDateString() + "</Created>"); sw.WriteLine("<LastSaved>" + DateTime.UtcNow.ToLocalTime().ToLongDateString() + "</LastSaved>"); sw.WriteLine("<Company>iDeal Teknoloji</Company>"); sw.WriteLine("<Version>12.00</Version>"); sw.WriteLine("</DocumentProperties>"); sw.WriteLine("<Worksheet ss:Name=\"Silverlight Export\" " + "xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\">"); sw.WriteLine("<Table>"); } sw.Write(strBuilder.ToString()); if (strFormat == "XLS") { sw.WriteLine("</Table>"); sw.WriteLine("</Worksheet>"); sw.WriteLine("</Workbook>"); } sw.Close(); }
public ManageC1GridColumns(C1DataGrid c1Grid) { grid = c1Grid; }
public DataGridHierarchicalNavigation(C1DataGrid dataGrid) : base(dataGrid) { }
public MyNavigationStrategy(C1DataGrid dataGrid) : base(dataGrid) { }
private void RemoveCurrentCell(C1DataGrid dataGrid, DataGridCellEventArgs e) { if (dataGrid != e.Cell.DataGrid) { dataGrid.CurrentRow = null; } foreach (var row in dataGrid.Rows.GetLoadedRows()) { if (row.Type == DataGridRowType.Item || row.Type == DataGridRowType.New) { if (row.DetailsPresenter != null) { var childDataGrid = row.DetailsPresenter.Content as C1DataGrid; if (childDataGrid != null) { RemoveCurrentCell(childDataGrid, e); } } } } }
private void RemoveSelection(C1DataGrid dataGrid, C1DataGrid changedDataGrid) { if (dataGrid != changedDataGrid) { dataGrid.Selection.Clear(); } foreach (var row in dataGrid.Rows.GetLoadedRows()) { if (row.Type == DataGridRowType.Item || row.Type == DataGridRowType.New) { if (row.DetailsPresenter != null) { var childDataGrid = row.DetailsPresenter.Content as C1DataGrid; if (childDataGrid != null) { RemoveSelection(childDataGrid, changedDataGrid); } } } } }
int _selStart, _selLength; // selection within cell public DataGridSpellWrapper(C1DataGrid grid) { _grid = grid; _cols = new List<C1.WPF.DataGrid.DataGridTextColumn>(); Initialize(); }
public DataGridHierarchicalNavigation(C1DataGrid dataGrid) : base(dataGrid) { }
private void SortGrid(C1DataGrid grid,DataGridColumn[] columns) { if (columns != null) grid.SortBy(columns); }
public ExportExcel(C1DataGrid dataGrid) : this() { DataGrid = dataGrid; }
public C1DataGrid GetRootGrid(C1DataGrid dataGrid) { var rootGrid = dataGrid; while (true) { var row = GetParentRow(rootGrid); if (row != null) { rootGrid = row.DataGrid; } else { break; } } return rootGrid; }
public MyNavigationStrategy(C1DataGrid dataGrid) : base(dataGrid) { }
public DataGridRow GetParentRow(C1DataGrid dataGrid) { return (dataGrid.Tag as DataGridRow); }