コード例 #1
0
 public FilterAtomEditor(PropertyDefinitionModel field)
 {
     InitializeComponent();
     IsWithEntityIdFilter = false;
     Filter = new FltAtomExprData()
     {
         Operator = FilterFieldOperator.Equal,
         PropertyType = field.Type,
         Field = field.Path
     };
     setField(field);
 }
コード例 #2
0
 public FilterElementEditor(CollectionVM collection, PropertyDefinitionModel elementDef, bool isPopupMode)
 {
     this.IsPopupMode = isPopupMode;
     InitializeComponent();
     this.propSelector.SelectedPropertyChanged += PropSelector_SelectedPropertyChanged;
     IsWithcollectionIdFilter = false;
     var field = elementDef;
     this.propSelector.Properties = collection.AvailableProperties;
     this.propSelector.SelectedProperty = elementDef;
     Filter = new FltAtomExprData()
     {
         Operator = FilterFieldOperator.Equal,
         PropertyType = field.Type,
         Field = field.Path
     };
     setField(field);
 }
コード例 #3
0
 public CollectionGridColumn(CollectionGrid dg, PropertyDefinitionModel prop)
 {
     _dg = dg;
     PropertyDefinition = prop;
     _fieldName = PropertyDefinition.Path;
     this.FieldName = PropertyDefinition.Path;
     TextBinding = new Binding($"[{FieldName}]")
     {
         UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
         Mode = BindingMode.OneWay,
         ValidatesOnDataErrors = true,
         NotifyOnValidationError = true
     }; 
     FrameworkElementFactory template = GetTemplate(TextBinding,  this);
     this.CellTemplate = new DataTemplate() { VisualTree = template };
     this.Header = PropertyDefinition.Path;
 }
コード例 #4
0
 public static FilterElementDefinition GetFieldFilterElement(PropertyDefinitionModel fieldData)
 {
     return new FilterElementDefinition(fieldData);
 }
コード例 #5
0
 private FilterElementDefinition(PropertyDefinitionModel fieldData)
 {
     FieldData = fieldData;
 }
コード例 #6
0
 public void AddColumn(PropertyDefinitionModel columnName)
 {
     this.Columns.Add(columnName);
     updateSelectedViewInConfig();
 }
コード例 #7
0
        private void setField(PropertyDefinitionModel field)
        {
            this.lCaption.Content = field.Path;

            FrameworkElement fe;

            if (field.Type == PropertyType.Float)
                fe = getBoolFilter(field);
            else if (field.Type == PropertyType.DateTime)
                fe = getDatePicker(field);
            else
                fe = getTextBox(field);
            fe.Margin = new Thickness(0);
            spMain.Children.Add(fe);
            _frameworkElement = fe;
        }
コード例 #8
0
 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;
 }
コード例 #9
0
        private FilterDatePicker getDatePicker(PropertyDefinitionModel field)
        {
            FilterDatePicker ftb = new FilterDatePicker();
            ftb.HasTime = false;
            ftb.Padding = new Thickness(0.0);
            ftb.Margin = new Thickness(0.0);
            ftb.Width = 120;
            ftb.HorizontalAlignment = HorizontalAlignment.Stretch;
            ftb.BorderBrush = ResourcesManager.Instance.GetBrush("IsReadOnlyBorderBrush");
            var fa = this.Filter as FltAtomExprData;
            //if(fa!=null)
            //    fa.Operator = FilterFieldOperator.Equal;
            ftb.SetBinding(FilterDatePicker.TextProperty, getFilterValueBinding());

            ftb.Height = 18;
            ftb.FontSize = 12;
            var operatorBinding = new Binding("Operator")
            {
                Source = this.Filter,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.TwoWay
            };
            ftb.SetBinding(FilterDatePicker.FilterTypeProperty, operatorBinding);
            ftb.SetBinding(FilterDatePicker.IsEnabledProperty, getIsEnabledBinding());
            ftb.KeyUp += (s, e) =>
                {
                    if (e.Key == Key.Enter)
                        activateFilter();
                };
            return ftb;
        }
コード例 #10
0
 private a7ComboBox getCombo(PropertyDefinitionModel field)
 {
     a7ComboBox cb = new a7ComboBox();
     (Filter as FltAtomExprData).Operator = FilterFieldOperator.Equal;
     cb.Width = 120;
     cb.Height = 18;
     cb.Template = ResourcesManager.Instance.GetControlTemplate("CustomComboBox");
     cb.Padding = new Thickness(0.0);
     cb.Margin = new Thickness(0.0);
     cb.HorizontalAlignment = HorizontalAlignment.Stretch;
     cb.Background = Brushes.White; //todo: ugly hardcode! :D
     cb.BorderBrush = ResourcesManager.Instance.GetBrush("IsReadOnlyBorderBrush"); //and here
     cb.Height = 18; //yup, hardcode
     //cb.DisplayMemberPath = "DisplayName";
     cb.ItemTemplate = a7ComboBox.CustomItemTemplate;
     cb.SelectedValuePath = "Id";
     cb.SetBinding(a7ComboBox.SelectedValueProperty, getFilterValueBinding());
     cb.SetBinding(a7ComboBox.IsEnabledProperty, getIsEnabledBinding());
     //cb.ItemsSource = a7Core.Instance.DataSourceManager.GetDataSourceItems(field.DataSourceId, bx).Collection;
     cb.SelectionChanged += (s, e) => activateFilter();
     return cb;
 }
コード例 #11
0
 private a7ComboBox getBoolFilter(PropertyDefinitionModel field)
 {
     a7ComboBox cb = new a7ComboBox();
     cb.SelectedValuePath = "Value";
     cb.DisplayMemberPath = "Name";
     cb.Width = 120;
     var items = new ObservableCollection<comboItem>();
     items.Add(new comboItem("1", "Yes"));
     items.Add(new comboItem("0", "No"));
     cb.ItemsSource = items;
     cb.Background = Brushes.White;
     cb.Template = ResourcesManager.Instance.GetControlTemplate("CustomComboBox");
     cb.Padding = new Thickness(0.0);
     cb.Margin = new Thickness(0.0);
     cb.HorizontalAlignment = HorizontalAlignment.Stretch;
     cb.BorderBrush = ResourcesManager.Instance.GetBrush("IsReadOnlyBorderBrush");
     cb.SetBinding(a7ComboBox.SelectedValueProperty, getFilterValueBinding());
     cb.SetBinding(a7ComboBox.IsEnabledProperty, getIsEnabledBinding());
     cb.Height = 18;
     cb.FontSize = 12;
     cb.SelectionChanged += (s, e) => activateFilter();
     return cb;
 }
コード例 #12
0
 private void setProperty(PropertyDefinitionModel selectedField)
 {
     var fae = new FilterElementEditor(_collection, selectedField, this.IsPopupMode) { Margin = new Thickness(0, 0, 0, 0), IsReadOnly = this.IsReadOnly };
     fae.EditorContext = this.EditorContext;
     var fge = new FilterGroupEditor(_collection, !_vertical, IsReadOnly, EditorContext)
     { Background = Brushes.White };
     fge.SetAtomFilter(fae);
     AddGroupSubFilter(fge);
     popupFieldSelect.IsOpen = false;
 }
コード例 #13
0
 private void setProperty(PropertyDefinitionModel selectedProperty)
 {
     gStartPanel.Visibility = Visibility.Collapsed;
     MyBorder.Visibility = System.Windows.Visibility.Visible;
     spButtons.Visibility = System.Windows.Visibility.Visible;
     var fge = new FilterGroupEditor(_collection, false, this.IsReadOnly, this);
     var fae = new FilterElementEditor(_collection, selectedProperty, this.IsPopupMode) { Margin = new Thickness(0, 0, 0, 0), IsReadOnly = this.IsReadOnly};
     fae.EditorContext = this;
     fge.SetAtomFilter(fae);
     this.FilterExpr = fge.Filter;
     SetRootGroup(fge);
 }
コード例 #14
0
 private void setField(PropertyDefinitionModel field)
 {
     if (this.IsPopupMode)
     {
         this.lCaption.Content = field.Path;
         this.firstColumn.Width = new GridLength(0);
     }
     else
     {
         this.lCaption.Content = "Field value";
         this.firstColumn.Width = new GridLength(50, GridUnitType.Star);
     }
     FrameworkElement fe;
     if (field.Type == PropertyType.Bool)
         fe = getBoolFilter(field);
     else if (field.Type == PropertyType.DateTime)
         fe = getDatePicker(field);
     else
         fe = getTextBox(field);
     fe.Margin = new Thickness(0);
     this.filterContainer.Content = fe;
     _frameworkElement = fe;
 }
コード例 #15
0
 private void AutoCompleteBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0 && e.AddedItems[0] is PropertyDefinitionModel)
     {
         this.SelectedProperty = e.AddedItems[0] as PropertyDefinitionModel;
         this.cbType.SelectedValue = this.SelectedProperty.Type;
         selectedPropertychanged();
     }
 }
コード例 #16
0
 private void AutoCompleteBox_TextChanged(object sender, RoutedEventArgs e)
 {
     var type = PropertyType.String;
     if (cbType.SelectedValue is PropertyType)
         type = (PropertyType)cbType.SelectedValue;
     else
         cbType.SelectedValue = type;
     this.SelectedProperty = new PropertyDefinitionModel
     {
         Name = acbProperty.Text,
         Path = acbProperty.Text,
         Type = type
     };
     selectedPropertychanged();
 }