public ProductWin(int CustomerId) { InitializeComponent(); DataContext = new vmProductLight(); this.RadGridView1.MouseDoubleClick += this.OnGridMouseDoubleClick; textBoxFilterValue.Focus(); this.Left = SystemParameters.PrimaryScreenWidth - this.Width; Telerik.Windows.Controls.GridViewColumn productColumn = this.RadGridView1.Columns["ProductId"]; Telerik.Windows.Controls.GridView.IColumnFilterDescriptor productFilter = productColumn.ColumnFilterDescriptor; //productColumn = this.RadGridView1.Columns["Description"]; //Telerik.Windows.Controls.GridView.IColumnFilterDescriptor productFilter2 = productColumn.ColumnFilterDescriptor; SunSeven.DataSource.JSDataContext lDataContext = new CommonFunction().JSDataContext(); foreach (var l in lDataContext.ProductFiltering(CustomerId)) { productFilter.DistinctFilter.AddDistinctValue(l.productId); // productFilter2.DistinctFilter.AddDistinctValue(l.Description); } }
public void RestoreValue(CustomPropertyInfo customPropertyInfo, object context, object value) { RadGridView gridView = context as RadGridView; switch (customPropertyInfo.Name) { case "Columns": { List <ColumnProxy> columnProxies = value as List <ColumnProxy>; foreach (ColumnProxy proxy in columnProxies) { GridViewColumn column = gridView.Columns[proxy.UniqueName]; column.DisplayIndex = proxy.DisplayOrder; column.Header = proxy.Header; column.Width = proxy.Width; } } break; case "SortDescriptors": { gridView.SortDescriptors.SuspendNotifications(); gridView.SortDescriptors.Clear(); List <SortDescriptorProxy> sortDescriptoProxies = value as List <SortDescriptorProxy>; foreach (SortDescriptorProxy proxy in sortDescriptoProxies) { GridViewColumn column = gridView.Columns[proxy.ColumnUniqueName]; gridView.SortDescriptors.Add(new ColumnSortDescriptor() { Column = column, SortDirection = proxy.SortDirection }); } gridView.SortDescriptors.ResumeNotifications(); } break; case "GroupDescriptors": { gridView.GroupDescriptors.SuspendNotifications(); gridView.GroupDescriptors.Clear(); List <GroupDescriptorProxy> groupDescriptorProxies = value as List <GroupDescriptorProxy>; foreach (GroupDescriptorProxy proxy in groupDescriptorProxies) { GridViewColumn column = gridView.Columns[proxy.ColumnUniqueName]; gridView.GroupDescriptors.Add(new ColumnGroupDescriptor() { Column = column, SortDirection = proxy.SortDirection }); } gridView.GroupDescriptors.ResumeNotifications(); } break; case "FilterDescriptors": { gridView.FilterDescriptors.SuspendNotifications(); foreach (var c in gridView.Columns) { if (c.ColumnFilterDescriptor.IsActive) { c.ClearFilters(); } } List <FilterSetting> filterSettings = value as List <FilterSetting>; foreach (FilterSetting setting in filterSettings) { Telerik.Windows.Controls.GridViewColumn column = gridView.Columns[setting.ColumnUniqueName]; Telerik.Windows.Controls.GridView.IColumnFilterDescriptor columnFilter = column.ColumnFilterDescriptor; foreach (object distinctValue in setting.SelectedDistinctValues) { columnFilter.DistinctFilter.AddDistinctValue(distinctValue); } if (setting.Filter1 != null) { columnFilter.FieldFilter.Filter1.Operator = setting.Filter1.Operator; columnFilter.FieldFilter.Filter1.Value = setting.Filter1.Value; columnFilter.FieldFilter.Filter1.IsCaseSensitive = setting.Filter1.IsCaseSensitive; } columnFilter.FieldFilter.LogicalOperator = setting.FieldFilterLogicalOperator; if (setting.Filter2 != null) { columnFilter.FieldFilter.Filter2.Operator = setting.Filter2.Operator; columnFilter.FieldFilter.Filter2.Value = setting.Filter2.Value; columnFilter.FieldFilter.Filter2.IsCaseSensitive = setting.Filter2.IsCaseSensitive; } } gridView.FilterDescriptors.ResumeNotifications(); } break; } }