public object ProvideValue(CustomPropertyInfo customPropertyInfo, object context)
      {
         var gridView = context as BindableRadGridView;

         switch (customPropertyInfo.Name)
         {
            case "SortDescriptors":
               {
                  var sortDescriptorProxies = new List<SortDescriptorProxy>();

                  foreach (ColumnSortDescriptor descriptor in gridView.SortDescriptors)
                  {
                     sortDescriptorProxies.Add(new SortDescriptorProxy()
                     {
                        ColumnUniqueName = descriptor.Column.UniqueName,
                        SortDirection = descriptor.SortDirection,
                     });
                  }

                  return sortDescriptorProxies;
               }

            case "GroupDescriptors":
               {
                  var groupDescriptorProxies = new List<GroupDescriptorProxy>();

                  foreach (ColumnGroupDescriptor descriotor in gridView.GroupDescriptors)
                  {
                     groupDescriptorProxies.Add(new GroupDescriptorProxy()
                     {
                        ColumnUniqueName = descriotor.Column.UniqueName,
                        SortDirection = descriotor.SortDirection,
                     });
                  }

                  return groupDescriptorProxies;
               }

            case "FilterDescriptors":
               {
                  var filterSettings = new List<FilterSetting>();

                  foreach (IColumnFilterDescriptor columnFilter in gridView.FilterDescriptors)
                  {
                     var columnFilterSetting = new FilterSetting();

                     columnFilterSetting.ColumnUniqueName = columnFilter.Column.UniqueName;

                     columnFilterSetting.SelectedDistinctValues.AddRange(columnFilter.DistinctFilter.DistinctValues);

                     if (columnFilter.FieldFilter.Filter1.IsActive)
                     {
                        columnFilterSetting.Filter1 = new FilterDescriptorProxy();
                        columnFilterSetting.Filter1.Operator = columnFilter.FieldFilter.Filter1.Operator;
                        columnFilterSetting.Filter1.Value = columnFilter.FieldFilter.Filter1.Value;
                        columnFilterSetting.Filter1.IsCaseSensitive = columnFilter.FieldFilter.Filter1.IsCaseSensitive;
                     }

                     columnFilterSetting.FieldFilterLogicalOperator = columnFilter.FieldFilter.LogicalOperator;

                     if (columnFilter.FieldFilter.Filter2.IsActive)
                     {
                        columnFilterSetting.Filter2 = new FilterDescriptorProxy();
                        columnFilterSetting.Filter2.Operator = columnFilter.FieldFilter.Filter2.Operator;
                        columnFilterSetting.Filter2.Value = columnFilter.FieldFilter.Filter2.Value;
                        columnFilterSetting.Filter2.IsCaseSensitive = columnFilter.FieldFilter.Filter2.IsCaseSensitive;
                     }

                     filterSettings.Add(columnFilterSetting);
                  }

                  return filterSettings;
               }
         }

         return null;
      }
Exemplo n.º 2
0
        public object ProvideValue(CustomPropertyInfo customPropertyInfo, object context)
        {
            var gridView = context as BindableRadGridView;

            switch (customPropertyInfo.Name)
            {
            case "SortDescriptors":
            {
                var sortDescriptorProxies = new List <SortDescriptorProxy>();

                foreach (ColumnSortDescriptor descriptor in gridView.SortDescriptors)
                {
                    sortDescriptorProxies.Add(new SortDescriptorProxy()
                        {
                            ColumnUniqueName = descriptor.Column.UniqueName,
                            SortDirection    = descriptor.SortDirection,
                        });
                }

                return(sortDescriptorProxies);
            }

            case "GroupDescriptors":
            {
                var groupDescriptorProxies = new List <GroupDescriptorProxy>();

                foreach (ColumnGroupDescriptor descriotor in gridView.GroupDescriptors)
                {
                    groupDescriptorProxies.Add(new GroupDescriptorProxy()
                        {
                            ColumnUniqueName = descriotor.Column.UniqueName,
                            SortDirection    = descriotor.SortDirection,
                        });
                }

                return(groupDescriptorProxies);
            }

            case "FilterDescriptors":
            {
                var filterSettings = new List <FilterSetting>();

                foreach (IColumnFilterDescriptor columnFilter in gridView.FilterDescriptors)
                {
                    var columnFilterSetting = new FilterSetting();

                    columnFilterSetting.ColumnUniqueName = columnFilter.Column.UniqueName;

                    columnFilterSetting.SelectedDistinctValues.AddRange(columnFilter.DistinctFilter.DistinctValues);

                    if (columnFilter.FieldFilter.Filter1.IsActive)
                    {
                        columnFilterSetting.Filter1                 = new FilterDescriptorProxy();
                        columnFilterSetting.Filter1.Operator        = columnFilter.FieldFilter.Filter1.Operator;
                        columnFilterSetting.Filter1.Value           = columnFilter.FieldFilter.Filter1.Value;
                        columnFilterSetting.Filter1.IsCaseSensitive = columnFilter.FieldFilter.Filter1.IsCaseSensitive;
                    }

                    columnFilterSetting.FieldFilterLogicalOperator = columnFilter.FieldFilter.LogicalOperator;

                    if (columnFilter.FieldFilter.Filter2.IsActive)
                    {
                        columnFilterSetting.Filter2                 = new FilterDescriptorProxy();
                        columnFilterSetting.Filter2.Operator        = columnFilter.FieldFilter.Filter2.Operator;
                        columnFilterSetting.Filter2.Value           = columnFilter.FieldFilter.Filter2.Value;
                        columnFilterSetting.Filter2.IsCaseSensitive = columnFilter.FieldFilter.Filter2.IsCaseSensitive;
                    }

                    filterSettings.Add(columnFilterSetting);
                }

                return(filterSettings);
            }
            }

            return(null);
        }