public AddEntityTypeWindow(CSDLView view) { InitializeComponent(); var nullValues = NullValue.GetValues("(none)"); _nullValue = nullValues[0]; _baseEntityTypeObj = _nullValue; nullEntityTypeCollection.Collection = nullValues; entityTypeCollection.Collection = view.EntityTypes; }
public EntityTableMapping(EntityType entityType) { if (entityType == null) { throw new ArgumentNullException(); } EntityType = entityType; InitializeComponent(); tableNullValues.Collection = NullValue.GetValues("<Delete>"); }
private ComboBoxEditableWhenFocused CreateComboBoxWithNull <T>(object businessObject, IEnumerable <T> items, string displayMemberPath, string bindingPropertyName, string isVisiblePropetyName, string isEnabledPropertyName) where T : class { var style = (Style)FindResource(COMBOBOX_STYLE); var comboBox = new ComboBoxEditableWhenFocused(); var itemType = items.GetType(); var nullValues = NullValue.GetValues("(none)"); comboBox.ItemsSource = new CompositeCollection() { new CollectionContainer() { Collection = nullValues }, new CollectionContainer() { Collection = items } }; var newStyle = new Style(typeof(ComboBoxEditableWhenFocused)); var fef = new FrameworkElementFactory(typeof(TextBlock)); fef.SetBinding(TextBlock.TextProperty, new Binding(displayMemberPath)); var styleResourceDictionary = new ResourceDictionary(); foreach (var trigger in style.Triggers) { newStyle.Triggers.Add(trigger); } foreach (var resourceKey in style.Resources.Keys) { styleResourceDictionary.Add(resourceKey, style.Resources[resourceKey]); } styleResourceDictionary.Add(itemType.GetGenericArguments()[0], new DataTemplate(itemType.GetGenericArguments()[0]) { VisualTree = fef }); newStyle.Resources = styleResourceDictionary; comboBox.Style = newStyle; SetCommunBindings(comboBox, ComboBoxEditableWhenFocused.SelectedValueProperty, new ComboBoxSelectedValueBindingWithNull <T>(businessObject.GetType().GetProperty(bindingPropertyName).GetValue(businessObject, null) ?? nullValues[0], (T value) => businessObject.GetType().GetProperty(bindingPropertyName).SetValue(businessObject, value, null)), "ComboSelectedValue", isVisiblePropetyName); if (isEnabledPropertyName != null) { comboBox.SetBinding(ComboBoxEditableWhenFocused.IsReadOnlyProperty, new Binding(isEnabledPropertyName) { Source = businessObject, Converter = new NotBoolConverter() }); } return(comboBox); }
public ColumnComboBox() { InitializeComponent(); columnNullValues.Collection = NullValue.GetValues(NullValueText); }
public PropertyConditionComboBox() { InitializeComponent(); propertyNullValues.Collection = NullValue.GetValues("<Delete>"); }