Telerik Forums
UI for WPF Forum
2 answers
545 views

I'm trying to create a custom filter for a RadGridView, but no matter what I do I get the following error.

 

The value "(CategoryList Contains Allergies)" is not of type "Telerik.Windows.Data.IFilterDescriptor" and cannot be used in this generic collection.
Parameter name: value

 

The column that the filter is on contains a List<string> of possibly multiple category names in each row and the filter contains a distinct list of the categories.

 

001.public partial class CategoryFilter : UserControl, IFilteringControl
002.{
003.    private GridViewBoundColumnBase _column;
004. 
005.    public delegate void BeginCategoryChangeEvent();
006.    public event BeginCategoryChangeEvent BeginCategoryChange;
007. 
008.    public delegate void CategoryChangeEvent();
009.    public event CategoryChangeEvent CategoryChange;
010.    private CompositeFilterDescriptor _compositeFilter;
011. 
012. 
013.    public class CategoryItem
014.    {
015.        public string CategoryName { get; set; }
016.        public bool IsChecked { get; set; }
017.    }
018. 
019.    private List<CategoryItem> MainCategoryList;
020. 
021.    /// <summary>
022.    /// Gets or sets a value indicating whether the filtering is active.
023.    /// </summary>
024.    public bool IsActive
025.    {
026.        get { return (bool)GetValue(IsActiveProperty); }
027.        set { SetValue(IsActiveProperty, value); }
028.    }
029. 
030.    /// <summary>
031.    /// Identifies the <see cref="IsActive"/> dependency property.
032.    /// </summary>
033.    public static readonly DependencyProperty IsActiveProperty =
034.        DependencyProperty.Register(
035.            "IsActive",
036.            typeof(bool),
037.            typeof(CategoryFilter),
038.            new System.Windows.PropertyMetadata(false));
039. 
040. 
041. 
042. 
043.    public bool this[string CategoryName]
044.    {
045.        get
046.        {
047.            CategoryItem item = MainCategoryList.FirstOrDefault(i => i.CategoryName == CategoryName);
048. 
049.            if (item == null)
050.                throw new Exception("Category Name not found");
051. 
052.            return (item.IsChecked);
053.        }
054.        set
055.        {
056.            CategoryItem item = MainCategoryList.FirstOrDefault(i => i.CategoryName == CategoryName);
057. 
058.            if (item == null)
059.                throw new Exception("Category Name not found");
060. 
061.            item.IsChecked = value;
062.        }
063.    }
064. 
065.    [TypeConverter(typeof(String))]
066.    public List<string> Categories
067.    {
068.        get
069.        {
070.            return MainCategoryList.Where(i => i.IsChecked).Select(i => i.CategoryName).ToList();
071.        }
072.        set
073.        {
074.            foreach (CategoryItem item in MainCategoryList)
075.            {
076.                item.IsChecked = value.Contains(item.CategoryName);
077.            }
078.        }
079.    }
080. 
081.    public System.Windows.Controls.ListBox CategoryList
082.    {
083.        get { return this.LstCategories; }
084.    }
085. 
086.    public CategoryFilter()
087.    {
088.        InitializeComponent();
089.    }
090. 
091.    public void Prepare(GridViewColumn column)
092.    {
093.        this._column = column as GridViewBoundColumnBase;
094.        if (this._column == null)
095.        {
096.            return;
097.        }
098. 
099.        List<string> catList = ((List<EducationChoices>)(column.DataControl.ItemsSource))
100.            .SelectMany(l => l.CategoryList)
101.            .Distinct()
102.            .Where(l => (l ?? "")
103.                .Trim() != "")
104.            .OrderBy(c => c)
105.            .ToList();
106. 
107.        MainCategoryList = catList
108.                .Select(i => new CategoryItem() {CategoryName = i, IsChecked = false})
109.                .ToList();
110. 
111.        LstCategories.ItemsSource = MainCategoryList;
112.    }
113. 
114.    private void ChangeFilter(object sender, RoutedEventArgs e) {
115.        BeginCategoryChange();
116. 
117.        if (_compositeFilter != null) {
118.            _column.DataControl.FilterDescriptors.Remove(_compositeFilter);
119.        }
120.        _compositeFilter = new CompositeFilterDescriptor { LogicalOperator = FilterCompositionLogicalOperator.Or };
121.        var dataMember = _column.DataMemberBinding.Path.Path;
122. 
123.        string Category = ((CheckBox)e.OriginalSource).Tag.ToString();
124. 
125.        foreach (var item in MainCategoryList) {
126.            if (item.IsChecked) {
127.                var filter = new FilterDescriptor(dataMember, FilterOperator.Contains, Category);
128.                _compositeFilter.FilterDescriptors.Add(filter);
129.            }
130.        }
131. 
132.        if ((((CheckBox)e.OriginalSource).IsChecked ?? false) &&
133.                    _compositeFilter.FilterDescriptors.All(f => ((FilterDescriptor)f).Value.ToString() != Category))
134.        {
135.            var filter = new FilterDescriptor(dataMember, FilterOperator.Contains, Category);
136.            _compositeFilter.FilterDescriptors.Add(filter);
137.        } else if (!(((CheckBox) e.OriginalSource).IsChecked ?? false) &&
138.                   _compositeFilter.FilterDescriptors.Any(f => ((FilterDescriptor) f).Value.ToString() == Category))
139.        {
140.            _compositeFilter.FilterDescriptors.Remove(
141.                _compositeFilter.FilterDescriptors.FirstOrDefault(
142.                    f => ((FilterDescriptor) f).Value.ToString() == Category));
143.        }
144.       
145. 
146.        if (!_column.DataControl.FilterDescriptors.Contains(_compositeFilter)) {
147.            _column.DataControl.FilterDescriptors.Add(_compositeFilter);
148.        }
149. 
150.        this.IsActive = true;
151. 
152.        CategoryChange();
153.    }
154.}

 

I found this thread and tried to figure out what it was doing, but it didn't help.

Dilyan Traykov
Telerik team
 answered on 05 Feb 2016
1 answer
72 views

I have a laptop with 1920 x 1080 resolution.  When placing a RadScheduleView into a Grid (with this the only object in this user control), if I maximize the Window, the ScheduleView will not maximize to the full extents of the screen.  However, if I press the Restore Down button on the screen to get the screen out of Maximize, and drag the screen to be as large as possible, the ScheduleView fills the entire screen.  I would like the ScheduleView to fill the entire screen when I press the maximize button.

Any thoughts on this behavior?

Thanks,

HH

Nasko
Telerik team
 answered on 05 Feb 2016
16 answers
1.2K+ views
Hello, All.

We are using RadChart version 2009.3.1322.35.

The chart is declared in XAML and databound to an ObservableCollection of DataPoints.  The collection contains 9000 data points, which makes the chart take 1 minute to display.

How can we improve the performance of the chart to accomodate thousands of data points?

Best regards,
Brian

Note: we have already set ChartArea EnableAnimations to false.
Martin Ivanov
Telerik team
 answered on 05 Feb 2016
3 answers
1.5K+ views

i don't want to apply default disable style  while IsEnabled="False" .

after this i get unwanted gray background . how to disable this styles 

Masha
Telerik team
 answered on 05 Feb 2016
2 answers
125 views

Hi! I've just finished installation of Telerik DevTools and I'd like to begin to use it now. I have a WPF MVVM Catel application that I've begun to develop since February 1 of this year. I've added the next assemblies of Catel there: Catel.Core, Catel.Extensions.Controls, Catel.Fody.Attributes, Catel.MVVM. I'd like to use Telerik RadTabControl there. Can I use Telerik RadTabControl inside catel:Window that is the main window of my application?

1) Which Telerik assemblies should I add to my application for successful using of Telerik UI for WPF components and controls?

2) Which Telerik assemblies should I add to my application for successful using of Telerik visual styles for decorating UI appearance?

 

Eugene
Top achievements
Rank 1
 answered on 04 Feb 2016
3 answers
191 views

Hi, 

 Is there an option of binding IsSelected Property for the Tile In MVVM for each of the item in list that is binded to RadTileList Control/

I am using Autogenerating tiles for the RadTileList Control.

 

Thanks,

Sandeep Kumar Vidiyala

Maya
Telerik team
 answered on 04 Feb 2016
2 answers
195 views
According to

http://docs.telerik.com/devtools/wpf/api/html/e_telerik_windows_controls_radpropertygrid_preparededitor.htm , and also to the auto completed event handler that is being created with double Tab, this should have worked, but when I try that, I get the exception above.

It looks like it is actually expecting RadRoutedEventHandler (looking at the cast inside the code), but trying to create a function with event args of type RadRoutedEventArgs generage (as expected) a compilation error.

 

Is this event even useful for anything?

 

 

BENN
Top achievements
Rank 1
 answered on 04 Feb 2016
4 answers
253 views

I’m trying to do something similar to Automation.  I need to drive a Web App containing Telerik controls.  Specifically, I need to click (which activates functionality) on elements of a RadPanelBar.  The RadPanelBar has two levels.  The top level has four siblings, each of which has about a dozen sub items.

 

I am using a Win Form application running a WebBrowser control.  This hosts the page pointing to the Telerick based web page containing the RadPanelBar.  I can successfully programmatically “Click” the top level item.  I first find the HtmlElement from its text property as shown on the working Telerik application.  I then simply use the element.InvokeMember(“click”) method.  This successfully expands the list of sub items on the page.  Doing the same on the sub elements successfully finds the HtmlElement, but the InvokeMember(“click”) method does nothing.  It does not give an error nor does it activate the code behind associated with the element.

I’ve looked at the underlying Dom for the page and have done Google searches using key words found in the actual html generated by the RadPanelBar in conjunction with keywords WebBrowser and InvokeMember.  All to no avail.

 

I am hoping someone with underlying knowledge of the RadPanelBar can suggest reasons why it works on the first tier, but not the second and hopefully points me in the right direction.

Thanks for any help you can provide.

Dennis
Top achievements
Rank 1
 answered on 04 Feb 2016
3 answers
629 views

Hi,

I have 2014.1.331.40 version.

I want to show multi page TIF file in image editor and also edit it. It is just showing first page of the TIF file.

Is there any option by which I can perform this functionality?

Thanks

Todor
Telerik team
 answered on 04 Feb 2016
4 answers
66 views

Hi Telerik,

I'm having trouble to keep the SearchPanel (the new feature from the latest 2016 release) working after changing the ItemsSource to a different collection (List<Object> where Object is a class with properties).

Before I assign a new ItemSource, I first assign null to the ItemsSource. I also tried to clear the FilterDescriptors (GridView.FilterDescriptors.Clear()), but I never get the SearchPanel working properly after changing the ItemsSource. Both highlithing and filyering seems to be broken after changing the ItemsSource.

Could you please help me to get this working?

Kind regards,

Peter Rakké

Peter
Top achievements
Rank 1
 answered on 03 Feb 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?