private FilterTextBox getTextBox(PropertyDefinitionModel field) { var ftb = new FilterTextBox(field, !this.IsPopupMode) { Padding = new Thickness(0), Width = 120 }; if (this.IsPopupMode) { ftb.Height = 26; } else { ftb.Height = 21; } ftb.SetBinding(FilterTextBox.TextProperty, getFilterValueBinding()); var faExpr = this.Filter as FltAtomExprData; if (faExpr != null && faExpr.Value.IsEmpty()) { if (field.Type == PropertyType.String) { (this.Filter as FltAtomExprData).Operator = FilterFieldOperator.Equal; } else { (this.Filter as FltAtomExprData).Operator = FilterFieldOperator.Equal; } } var operatorBinding = new Binding("Operator") { Source = this.Filter, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.TwoWay }; ftb.SetBinding(FilterTextBox.FilterTypeProperty, operatorBinding); ftb.SetBinding(FilterTextBox.PropertyTypeProperty, new Binding("PropertyType") { Source = this.Filter, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.TwoWay }); ftb.SetBinding(FilterTextBox.IsEnabledProperty, this.getIsEnabledBinding()); ftb.BorderBrush = ResourcesManager.Instance.GetBrush("IsReadOnlyBorderBrush"); ftb.KeyUp += (s, e) => { if (e.Key == Key.Enter) { activateFilter(); } }; return(ftb); }
private void getTextColumnFilterControl() { FilterTextBox ftb = new FilterTextBox(this.PropertyDefinition, false); ftb.KeyUp += new System.Windows.Input.KeyEventHandler(ftb_KeyUp); ftb.KeyDown += new System.Windows.Input.KeyEventHandler(ftb_KeyDown); ftb.Padding = new Thickness(0.0); ftb.Margin = new Thickness(0.0); ftb.HorizontalAlignment = HorizontalAlignment.Stretch; ftb.BorderBrush = ResourcesManager.Instance.GetBrush("IsReadOnlyBorderBrush"); if (ftb.IsEnabled) { Binding tbBinding = new Binding("Collection.Filter.FieldsFilter[" + this.FieldName + "]") { Source = _dg, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; ftb.SetBinding(FilterTextBox.TextProperty, tbBinding); } ftb.Height = 30; ftb.FontSize = 12; Binding cbBinding = new Binding("Collection.Filter.FieldsFilter.FieldFilters[" + this.FieldName + "].Operator") { Source = _dg, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.TwoWay }; ftb.SetBinding(FilterTextBox.FilterTypeProperty, cbBinding); Binding typeBinding = new Binding("Collection.Filter.FieldsFilter.FieldFilters[" + this.FieldName + "].PropertyType") { Source = _dg, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.TwoWay }; ftb.SetBinding(FilterTextBox.PropertyTypeProperty, typeBinding); ftb.FilterTypeChanged += new EventHandler(ftb_FilterTypeChanged); ftb.PropertyChanged += Ftb_PropertyChanged; _columnFilterControl = ftb; }
private FilterTextBox getTextBox(PropertyDefinitionModel field) { var ftb = new FilterTextBox(field) { Height = 28, Padding = new Thickness(0), Width = 120 }; ftb.IsInlineMode = true; // ftb.FilterType = (this.Filter as FltAtomExprData).Operator; ftb.SetBinding(FilterTextBox.TextProperty, getFilterValueBinding()); var faExpr = this.Filter as FltAtomExprData; if (faExpr != null && faExpr.Value.IsEmpty()) { if (field.Type == PropertyType.String) (this.Filter as FltAtomExprData).Operator = FilterFieldOperator.Contains; else (this.Filter as FltAtomExprData).Operator = FilterFieldOperator.Equal; } var operatorBinding = new Binding("Operator") { Source = this.Filter, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.TwoWay }; ftb.SetBinding(FilterTextBox.FilterTypeProperty, operatorBinding); ftb.SetBinding(FilterTextBox.PropertyTypeProperty, new Binding("PropertyType") { Source = this.Filter, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.TwoWay }); ftb.SetBinding(FilterTextBox.IsEnabledProperty, this.getIsEnabledBinding()); ftb.BorderBrush = ResourcesManager.Instance.GetBrush("IsReadOnlyBorderBrush"); ftb.KeyUp += (s, e) => { if (e.Key == Key.Enter) activateFilter(); }; return ftb; }