public FilterAtomEditor(PropertyDefinitionModel field)
 {
     InitializeComponent();
     IsWithEntityIdFilter = false;
     Filter = new FltAtomExprData()
     {
         Operator = FilterFieldOperator.Equal,
         PropertyType = field.Type,
         Field = field.Path
     };
     setField(field);
 }
 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);
 }
 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;
 }
 public static FilterElementDefinition GetFieldFilterElement(PropertyDefinitionModel fieldData)
 {
     return new FilterElementDefinition(fieldData);
 }
 private FilterElementDefinition(PropertyDefinitionModel fieldData)
 {
     FieldData = fieldData;
 }
 public void AddColumn(PropertyDefinitionModel columnName)
 {
     this.Columns.Add(columnName);
     updateSelectedViewInConfig();
 }
        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;
        }
 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;
 }
        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;
        }
 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;
 }
 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;
 }
 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;
 }
 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);
 }
 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;
 }
 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();
     }
 }
 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();
 }