public override System.Windows.Controls.ValidationResult Validate(object value, System.Globalization.CultureInfo culture, Xceed.Wpf.DataGrid.CellValidationContext context) { if (value == null) return ValidationResult.ValidResult; Cell cell = context.Cell; OrderQuantity checkingObject = cell.DataContext as OrderQuantity; double minValue = checkingObject.MinValue; double maxValue = checkingObject.MaxValue; if (value is string) value = double.Parse((string)value); if (cell.FieldName == OrderQuantity.PROP_NAME_MinValue) minValue = (double)value; else if (cell.FieldName == OrderQuantity.PROP_NAME_MaxValue) maxValue = (double)value; else System.Diagnostics.Debug.Assert(false); string newValue = value.ToString(); if (minValue > maxValue) return new ValidationResult(false, (string)App.Current.FindResource("NotValidRangeText")); return ValidationResult.ValidResult; }
private void TaskSettings_PropertyValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { if (TaskSettings.SelectedPropertyItem == null) return; _isError = false; // Х.з. как по уму обновить PropertyGrid. var pdc = TypeDescriptor.GetProperties(_clonnedSettings); if (!pdc .Cast<PropertyDescriptor>() .Any(propertyDescriptor => propertyDescriptor .Attributes .OfType<DisplayNameAttribute>() .Select(a => a.DisplayName) .Contains(TaskSettings.SelectedPropertyItem.DisplayName) && propertyDescriptor .Attributes .OfType<AuxiliaryAttribute>() .Count() != 0)) return; TaskSettings.SelectedObject = new object(); TaskSettings.SelectedObject = _clonnedSettings; }
/// <summary> /// Exporta la información de un dataGridView a Excel de manera dinamica /// </summary> /// <param name="dataGridView">DataGridView de origen</param> /// <param name="pFullPath_toExport">Ruta del archivo exportado</param> /// <param name="nameSheet">Nombre de la hoja</param> public void dataGridView2ExcelDinamico(Xceed.Wpf.DataGrid.DataGridControl dataGridView, string pFullPath_toExport, string nameSheet) { System.Data.DataTable dt = new System.Data.DataTable(); ExcelExport myExcel = new ExcelExport(); myExcel.CreateWorksheet(nameSheet); //Recorro el DataGrid para buscar las columnas foreach (Xceed.Wpf.DataGrid.Column Column in dataGridView.Columns) { dt.Columns.Add(Column.Title.ToString()); } foreach (DataRow DataRow in dataGridView.Items) { DataRow dr = dt.NewRow(); foreach (Xceed.Wpf.DataGrid.Column Column in dataGridView.Columns) { dr[Column.Title.ToString()] = DataRow[Column.Title.ToString()]; } dt.Rows.Add(dr); } myExcel.PopulateFromDataTable(nameSheet, dt); myExcel.SaveToFile(pFullPath_toExport); //dataTable2ExcelDinamico(dt, dataGridView, pFullPath_toExport, nameSheet); }
private void tskCTAnywhere_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e) { using (CTAnywhere.frmCTADashboard objCTADashboard = new global::CTWebMgmt.CTAnywhere.frmCTADashboard()) { objCTADashboard.ShowDialog(); } }
internal override void UpdateThemeResources( Xceed.Wpf.AvalonDock.Themes.Theme oldTheme = null ) { base.UpdateThemeResources(oldTheme); if (_overlayWindow != null) _overlayWindow.UpdateThemeResources(oldTheme); }
/// <summary> /// /// </summary> /// <param name="cell"></param> /// <param name="e"></param> /// <param name="handled"></param> protected override void PaintCellForeground(Xceed.Grid.Cell cell, Xceed.Grid.GridPaintEventArgs e, ref bool handled) { if ((Control.MouseButtons == MouseButtons.Left) && (cell.RectangleToScreen(e.ClientRectangle).Contains(Control.MousePosition))) { ControlPaint.DrawButton(e.Graphics, e.DisplayRectangle, ButtonState.Pushed); } else { ControlPaint.DrawButton(e.Graphics, e.DisplayRectangle, ButtonState.Normal); } //using (SolidBrush brush = new SolidBrush(cell.GetDisplayVisualStyle(VisualGridElementState.Idle).ForeColor)) //{ // Rectangle textRectangle = e.DisplayRectangle; // textRectangle.Inflate(-2, -2); // if ((textRectangle.Height > 0) && (textRectangle.Width > 0)) // { // // Paint a fixed text // e.Graphics.DrawString(m_text, cell.Font, brush, textRectangle); // // For text that follows the value of the cell, you could do someting like the following : // // e.Graphics.DrawString( this.GetTextToPaint(), this.Font, brush, textRectangle ); // } //} }
/// <summary> /// Constructor /// </summary> public MyCalendar(Xceed.Editors.WinCalendar template) : base(template) { this.DayMargins = new Xceed.Editors.Margins(10, 10, 0, 0); this.EnableMultipleMonths = false; this.WeekDaysHeader.DayNames = new string[] { "һ", "��", "��", "��", "��", "��", "��" }; if (this.TodayButton != null) { this.TodayButton.Text = "����"; this.TodayButton.Height = 20; this.TodayButton.Location = new System.Drawing.Point(65, 123); } if (this.NoneButton != null) { this.NoneButton.Text = "��"; this.NoneButton.Height = 20; this.NoneButton.Location = new System.Drawing.Point(160, 123); } }
void _wizard_Next(object sender, Xceed.Wpf.Toolkit.Core.CancelRoutedEventArgs e) { var current = this._wizard.CurrentPage; if (current.Name.Equals("BaseSettingsPage")) { var hasContext = current as IHasContext; if (hasContext != null) { var pushPullModel = ((PageOneContext)hasContext.Context).DataModel; switch (pushPullModel) { case PushPullModel.PushData: { current.NextPage = (WizardPage)_wizard.Items[2]; break; } case PushPullModel.PullData: { current.NextPage = (WizardPage)_wizard.Items[3]; break; } case PushPullModel.FormSheet: { break; } } } } }
bool ICellViewer.PaintCellValue( Xceed.Grid.GridPaintEventArgs e, Xceed.Grid.Cell cell ) { /* if ( !(cell.Value is int) ) return false; int nVal = (int)cell.Value; if ( nVal<100 ) { GruppNumrering gn = (GruppNumrering)nVal; Rectangle rect = PlataDM.vdUsr.ImgHelper.adaptProportionalRect( e.ClientRectangle, 100, 100 ); e.Graphics.FillEllipse( PlataDM.Global.GruppNumreringTillFärg(gn), rect ); switch ( gn ) { case GruppNumrering.EjNamnsättning: case GruppNumrering.EjNumrering: e.Graphics.DrawString( "ej", cell.Font, Brushes.Black, rect, vdUsr.Util.sfCenter ); break; } } */ PlataDM.Util.paintGroupNumberingSymbol( e.Graphics, cell.Font, cell.ParentRow.Tag as PlataDM.Grupp, vdUsr.ImgHelper.adaptProportionalRect( e.ClientRectangle, e.ClientRectangle.Height - 2, e.ClientRectangle.Height - 2 ) ); return true; }
/// <summary> /// GetTextCore /// </summary> /// <param name="value"></param> /// <param name="formatInfo"></param> /// <param name="gridElement"></param> /// <returns></returns> protected override string GetTextCore(object value, Xceed.Grid.CellTextFormatInfo formatInfo, Xceed.Grid.GridElement gridElement) { DateTime minValue; DateTime time = this.GetDate(value, formatInfo, gridElement); object nullValue = formatInfo.NullValue; if (nullValue is DateTime) { minValue = (DateTime) nullValue; } else { minValue = DateTime.MinValue; } if (time == minValue) { return formatInfo.NullText; } string formatSpecifier = formatInfo.FormatSpecifier; if (string.IsNullOrEmpty(formatSpecifier)) { formatSpecifier = "d"; } return time.ToString(formatSpecifier, m_format); }
private void tskBatchWebCamperDetailRpt_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e) { using (Ind.Reports.frmBatchWebCamperDetailSetup objBatchWebCamperDetailSetup = new global::CTWebMgmt.Ind.Reports.frmBatchWebCamperDetailSetup()) { objBatchWebCamperDetailSetup.ShowDialog(); } }
private void mnuDiscounts_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e) { using (Ind.Setup.frmDiscounts objDiscounts = new global::CTWebMgmt.Ind.Setup.frmDiscounts()) { objDiscounts.ShowDialog(); } }
private void tskCustomFlagFieldDefs_Click(object sender, Xceed.SmartUI.SmartItemClickEventArgs e) { Admin.frmSyncCustomFlags objSyncCustomFlags = new global::CTWebMgmt.Admin.frmSyncCustomFlags(); objSyncCustomFlags.MdiParent = this; objSyncCustomFlags.Show(); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem property_item) { Binding binding = new Binding("Value"); binding.Source = property_item; binding.Mode = property_item.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(this, OpenTexUserControlEditor.ValueProperty, binding); return this; }
public win_seleccion_ejes_reporte_estadistica(Xceed.Wpf.DataGrid.DataGridControl grid) { ValoresEjes = new List<Empresa.Comun.valores_dependientes_independientes>(); InitializeComponent(); this.__grid = grid; __valores_item(); //_datos(__grid); }
private void Wizard_Previous(object sender, Xceed.Wpf.Toolkit.Core.CancelRoutedEventArgs e) { IWizardPageControl c = _wizard.CurrentPage.Content as IWizardPageControl; if (c != null) { e.Cancel = !c.Previous(); } }
public Moderator( Window aParentWindow, Xceed.Wpf.Toolkit.Primitives.WindowContainer aWindowContainer) : this() { myParentWindow = aParentWindow; cadViews = aWindowContainer; TestStr = "hh"; }
public static void btn批量确认_Click(Xceed.Grid.GridControl grid, Action<object, System.EventArgs> action, string selectColumnName = "选定", string confirmColumnName = "确认") { foreach (Xceed.Grid.DataRow row in grid.DataRows) { bool? b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells[selectColumnName].Value); if (b.HasValue && b.Value) { action(row.Cells[confirmColumnName], System.EventArgs.Empty); } } }
/// <summary> /// GetNumber /// </summary> /// <param name="dataType"></param> /// <param name="value"></param> /// <param name="formatInfo"></param> /// <param name="gridElement"></param> /// <returns></returns> protected override object GetNumber(Type dataType, object value, Xceed.Grid.CellTextFormatInfo formatInfo, Xceed.Grid.GridElement gridElement) { object nullValue = formatInfo.NullValue; if (((value != null) && (value != DBNull.Value)) && (!string.Empty.Equals(value) && !value.Equals(nullValue))) { return Convert.ChangeType(value, dataType, m_format); } return nullValue; }
public static void SetUIStyle(Xceed.SmartUI.SmartControl uiControl) { try { switch (DefaultUIStyle) { case "WindowsClassic": uiControl.UIStyle = Xceed.SmartUI.UIStyle.UIStyle.WindowsClassic; break; case "WindowsXP": uiControl.UIStyle = Xceed.SmartUI.UIStyle.UIStyle.WindowsXP; break; case "OfficeXP": uiControl.UIStyle = Xceed.SmartUI.UIStyle.UIStyle.OfficeXP; break; case "Office2003": uiControl.UIStyle = Xceed.SmartUI.UIStyle.UIStyle.Office2003; break; case "ResourceAssembly": uiControl.UIStyle = Xceed.SmartUI.UIStyle.UIStyle.ResourceAssembly; System.Reflection.Assembly resourceAssembly = null; switch (DefaultUIStyleResourceAssembly) { case "Blue": resourceAssembly = TryLoadAssembly("Xceed.SmartUI.UIStyle.WindowsXP.Blue"); break; case "OliveGreen": resourceAssembly = TryLoadAssembly("Xceed.SmartUI.UIStyle.WindowsXP.OliveGreen"); break; case "Silver": resourceAssembly = TryLoadAssembly("Xceed.SmartUI.UIStyle.WindowsXP.Silver"); break; default: throw new NotSupportedException("Not supported UIStyleResourceAssembly!"); } if (resourceAssembly != null) { uiControl.UIStyleResourceAssembly = resourceAssembly; } break; default: throw new NotSupportedException("Not supported UIStyle!"); } } // maybe not support catch (NotSupportedException) { } catch (Exception ex) { ExceptionProcess.ProcessWithResume(ex); } }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { //textBox.Background = new SolidColorBrush(Colors.Red); //create the binding from the bound property item to the editor var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(textBox, TextBox.TextProperty, _binding); return textBox; }
internal CheckColumnHelper(Xceed.Grid.Column checkColumn, IGrid grid) { InitializeComponent(); m_checkColumn = checkColumn; m_grid = grid; if (m_grid.GridControl != null) { m_grid.GridControl.SelectionMode = SelectionMode.MultiExtended; } (checkColumn.CellEditorManager.TemplateControl as Xceed.Editors.WinCheckBox).ThreeState = false; this.m_selectColumnName = checkColumn.FieldName; }
internal static void SetCellValueNone(Xceed.Grid.Cell cell) { if (cell.ParentColumn.DataType == typeof(string)) { if (cell.Value != null && string.IsNullOrEmpty((string)cell.Value)) { cell.Value = null; } } if (cell != null) { cell.NullText = "-"; } }
/// <summary> /// GetDate /// </summary> /// <param name="value"></param> /// <param name="formatInfo"></param> /// <param name="gridElement"></param> /// <returns></returns> protected override DateTime GetDate(object value, Xceed.Grid.CellTextFormatInfo formatInfo, Xceed.Grid.GridElement gridElement) { object nullValue = formatInfo.NullValue; if (((value != null) && (value != DBNull.Value)) && (!string.Empty.Equals(value) && !value.Equals(nullValue))) { return Convert.ToDateTime(value, m_format); } if (nullValue is DateTime) { return (DateTime) nullValue; } return DateTime.MinValue; }
internal static Tuple<string, object> GetDataCellValue(string s2, Xceed.Grid.Cell cell) { string s1 = s2; // maybe there is '.' int idx = s1.IndexOf('_'); string dataControlName, propertyName; if (idx == -1) { dataControlName = s1; propertyName = null; } else { dataControlName = s1.Substring(0, idx); propertyName = s1.Substring(idx + 1); } object o = null; if (cell.ParentRow.Cells[dataControlName] != null) { o = cell.ParentRow.Cells[dataControlName].Value; } else { // 如果未找到Cell,则找父级DataControl IDisplayManagerContainer form = cell.GridControl.FindForm() as IDisplayManagerContainer; if (form != null) { IDataControl parentDc = form.DisplayManager.DataControls[dataControlName]; o = parentDc.SelectedDataValue; } } if (!string.IsNullOrEmpty(propertyName)) { propertyName = propertyName.Replace('_', '.'); o = EntityScript.GetPropertyValue(o, propertyName); } //if (o == null) //{ // throw new ArgumentException("there is no column or datacontrol with name " + s1 + "!"); //} return new Tuple<string, object>(dataControlName, o); }
/// <summary> /// /// </summary> /// <param name="column"></param> /// <param name="info"></param> public static void CreateCellEditorManager(Xceed.Grid.Column column, GridColumnInfo info, IDisplayManager dm) { try { Xceed.Grid.Editors.CellEditorManager editor = ControlFactory.CreateCellEditorManager(dm.Name, info.CellEditorManager, info.CellEditorManagerParam, GridColumnInfoHelper.CreateType(info), (string)ParamCreatorHelper.TryGetParam(info.CellEditorManagerParamFilter), info.CellViewerManagerParam); if (editor != null) { column.CellEditorManager = editor; } } catch (Exception ex) { throw new ArgumentException("GridColumnInfo of " + info.Name + " is Invalid when CreateCellEditorManager!", ex); } }
private void LSF(object sender, Xceed.Wpf.AvalonDock.Layout.Serialization.LayoutSerializationCallbackEventArgs arg) { if(!string.IsNullOrWhiteSpace(arg.Model.ContentId)) { Uri u; if(!Uri.TryCreate(arg.Model.ContentId, UriKind.Absolute, out u)) { Log.Warning("Restore Layout({0}) - Bad ContentID", arg.Model.ContentId); arg.Cancel = true; return; } string view = u.Query; if(view != null && view.StartsWith("?view=")) { view = view.Substring(6); } else { view = null; } arg.Content = DWorkspace.This.Open(u.GetLeftPart(UriPartial.Path), view); if(arg.Content == null) { arg.Cancel = true; } } }
public override System.Windows.Controls.ValidationResult Validate(object value, System.Globalization.CultureInfo culture, Xceed.Wpf.DataGrid.CellValidationContext context) { Cell cell = context.Cell; OrderCategory checkingObject = cell.DataContext as OrderCategory; if (checkingObject != null) { if (value != null) { string newValue = value.ToString(); foreach (OrderCategory element in SymbologyManager.OrderCategories) if (!element.Equals(checkingObject) && element.Value != null && element.Value.Equals(newValue)) return new ValidationResult(false, (string)App.Current.FindResource("ValueValidationRuleText")); } } return ValidationResult.ValidResult; }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { DockPanel dp = new DockPanel(); dp.LastChildFill = true; Button bt = new Button(); bt.Content = "..."; bt.Click += new RoutedEventHandler(bt_Click); DockPanel.SetDock(bt, Dock.Right); dp.Children.Add(bt); tb = new TextBox(); tb.Text = "xyz"; dp.Children.Add(tb); //create the binding from the bound property item to the editor var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(tb, TextBox.TextProperty, _binding); return dp; }
/// <summary> /// /// </summary> /// <param name="column"></param> /// <param name="info"></param> public static void CreateCellViewerManager(Xceed.Grid.Column column, GridColumnInfo info, IDisplayManager dm) { try { Xceed.Grid.Viewers.CellViewerManager viewer = ControlFactory.CreateCellViewerManager(dm.Name, info.CellViewerManager, info.CellViewerManagerParam, GridColumnInfoHelper.CreateType(info)); if (viewer != null) { column.CellViewerManager = viewer; System.Collections.IComparer comp = ControlFactory.CreateColumnDataComparer( info.CellViewerManager, info.CellViewerManagerParam, GridColumnInfoHelper.CreateType(info)); if (comp != null) { column.DataComparer = comp; } } } catch (Exception ex) { throw new ArgumentException("GridColumnInfo of " + info.Name + " is Invalid when CreateCellViewerManager!", ex); } }