private void ShowExpressionWindow() { try { SetColumnInfo(); //Конвертируем название свойств в название столбцов. foreach (var p in StylesCollection.Where(p => p != null)) { if (p.ExpressionString == null) { p.ExpressionString = string.Empty; } else if (p.ExpressionString != string.Empty) { p.ExpressionString = p.Parent.ConvertToCaptions(p.ExpressionString); } if (p.FormatConditionType == FormatConditionType.Default && string.IsNullOrEmpty(p.Name)) { p.Name = p.ExpressionString; } } var window = new ConditionalFormattingWindow(View, StylesCollection) { Owner = Application.Current.MainWindow.IsActive ? Application.Current.MainWindow : null }; if (window.ShowDialog() == true) { Dispatcher.Invoke(new Action(delegate { if (View.Grid is CustomGridControl) { var grid = (CustomGridControl)View.Grid; grid.ExpressionStyleOptions.Clear(); //Конвертируем название столбцов в название свойств. foreach (var p in StylesCollection.Where(p => p != null && !string.IsNullOrEmpty(p.ExpressionString))) { p.ExpressionString = p.Parent.ConvertToFields(p.ExpressionString); } grid.ExpressionStyleOptions.Options.AddRange( StylesCollection.Where(p => p != null && !p.IsReadOnly)); } View.ClearFormatConditionsFromAllColumns(); CollectionModify(); })); } } finally { ShowFormatConditionsEditorWindow = false; } }
private void ShowExpressionWindow() { try { SetColumnInfo(); //Конвертируем название свойств в название столбцов. foreach (var p in StylesCollection.Where(p => p != null)) { if (p.ExpressionString == null) { p.ExpressionString = string.Empty; } else if (p.ExpressionString != string.Empty) { p.ExpressionString = p.Parent.ConvertToCaptions(p.ExpressionString); } if (p.FormatConditionType == FormatConditionType.Default && string.IsNullOrEmpty(p.Name)) { p.Name = p.ExpressionString; } } var window = new ConditionalFormattingWindow(View, StylesCollection, true) { Owner = Application.Current.MainWindow.IsActive ? Application.Current.MainWindow : null }; if (window.ShowDialog() == true) { if (View != null && View.DataControl is CustomTreeListControl) { var tree = (CustomTreeListControl)View.DataControl; tree.ExpressionStyleOptions.Clear(); //Конвертируем название столбцов в название свойств. foreach (var p in StylesCollection) { p.ExpressionString = p.Parent.ConvertToFields(p.ExpressionString); } tree.ExpressionStyleOptions.Options.AddRange(StylesCollection.Where(p => p != null && !p.IsReadOnly)); } } } finally { ShowFormatConditionsEditorWindow = false; } }