protected virtual NormalWindow SetNormalWindowEntity(NormalWindow win, ModifiableEntity entity, ViewOptionsBase options, EntitySettings es, Control ctrl) { Type entityType = entity.GetType(); win.MainControl = ctrl; win.ShowOperations = options.ShowOperations; win.ViewMode = options.ViewButtons; entity = options.Clone ? (ModifiableEntity)((ICloneable)entity).Clone() : entity; win.OnPreEntityLoaded(entity); win.DataContext = entity; if (options.ReadOnly ?? OnIsReadOnly(entityType, entity)) { Common.SetIsReadOnly(win, true); } if (options is ViewOptions) { win.SaveProtected = ((ViewOptions)options).RequiresSaveOperation ?? (typeof(Entity).IsAssignableFrom(entityType) && EntityKindCache.RequiresSaveOperation(entityType)); //Matters even on Ok } TaskNormalWindow?.Invoke(win, entity); return(win); }
private void StackPanel_Loaded(object sender, RoutedEventArgs e) { FilterOption f = (FilterOption)valueContainer.DataContext; Common.SetIsReadOnly(valueContainer, f.Frozen); RecreateControls(); }
public static void TaskSetIsReadonly(FrameworkElement fe, string route, PropertyRoute context) { bool isReadOnly = context.PropertyRouteType == PropertyRouteType.FieldOrProperty && context.PropertyInfo.IsReadOnly(); if (isReadOnly && fe.NotSet(Common.IsReadOnlyProperty) && (fe is ValueLine || fe is EntityLine || fe is EntityCombo || fe is TextArea)) { Common.SetIsReadOnly(fe, isReadOnly); } }
public static T Editable <T>(this T uiElement) where T : UIElement { Common.SetIsReadOnly(uiElement, false); return(uiElement); }
public static T ReadOnly <T>(this T uiElement) where T : UIElement { Common.SetIsReadOnly(uiElement, true); return(uiElement); }