This is a migrated thread and some comments may be shown as answers.

Change Members DropDown in DataFilter

13 Answers 135 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 28 Jun 2012, 03:00 PM
Is it possible to change the Members DropDown (PART_SimpleFilterMemberComboBox) in the filter criteria to a treeview? We have a large number of fields that are listed at the moment and it is difficult for users to scroll through them all.

13 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Jun 2012, 03:12 PM
Hi,

I am afradi that RadDataFilter does not support such customization.

Regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Shankar
Top achievements
Rank 1
answered on 08 Aug 2012, 02:45 PM
@XamlmaX, did you figure out a way (or a workaround) for your problem? Please let me know. I am looking for a similar functionality

Thanks,
0
Pete
Top achievements
Rank 1
answered on 08 Aug 2012, 03:53 PM
Yes, I think so - although I haven't implemented it yet so i can't be 100% sure.

See my response to a related problem here: http://www.telerik.com/community/forums/silverlight/data-filter/readonly-filter-descriptor.aspx
If you look in the xaml for "PART_SimpleFilterOperatorCombobox" you will see this is the combobox in the RadDataFilter. You should be able to replace this with a treeview (as long as you give it the same name) and it should work.

Hope this helps.
0
Shankar
Top achievements
Rank 1
answered on 08 Aug 2012, 04:09 PM
So, this solution requires me to change the XAML in the Telerik API and recompile the binaries?

If I change the xaml by making the PART_SimpleFilterOperatorCombobox a Treeview, it should not affect any other place right?
0
Pete
Top achievements
Rank 1
answered on 08 Aug 2012, 04:11 PM
Only where you have a RadDataFilter (if you choose not to put a key on your style), or only the RadDataFilters where you apply your named style
0
Shankar
Top achievements
Rank 1
answered on 08 Aug 2012, 04:19 PM
Thanks! that would help. However please let me know one more thing.

Is there a way we can define this style attribute in our xaml and when we define the RadDataFilter (in our xaml) we override the default style with our defined style (where I want to change the RadComboBox style property). This way we need not recompile the Telerik API library binary (Telerik.Windows.Controls.Data.dll)

Please let me know if that is a possibility. Once again, thanks for the information.
0
Pete
Top achievements
Rank 1
answered on 09 Aug 2012, 08:44 AM
Yes. Please see the link I posted to my other issue.
Open Telerik.Windows.Controls.Data.dll in notepad and search for the RadDataFilter .This will give you the template for the control.
Extract that into a resource dictionary and use it as you would any other template in Silverlight (i.e. add a key if you want to use it in specific circumstances, or remove the key if you want it to apply to all instances of that particular TargetType). You do not need to recompile the Telerik libraries as your style/template will override the default.
0
Shankar
Top achievements
Rank 1
answered on 13 Aug 2012, 03:06 PM
@XamlmaX,

Thank you for the solution, this worked, however I am now having a problem in setting the ItemSource and SelectedItem property for the control.

This is due to the reason that I am using a Custom Control instead of the RadComboBox for the members dropdown

Could you please throw some light on this?
0
Pete
Top achievements
Rank 1
answered on 13 Aug 2012, 03:37 PM
0
Shankar
Top achievements
Rank 1
answered on 16 Aug 2012, 04:52 PM
Thank you so much Xamlmax!! This works perfectly..
0
Pete
Top achievements
Rank 1
answered on 21 Jan 2013, 09:27 AM
Hi Shankar
Did you get this working properly in the end? I am trying this myself now but the DataFilter seems to be ignoring my customized template.
0
Shankar
Top achievements
Rank 1
answered on 21 Jan 2013, 08:32 PM
Hi Pete, yes I got it to work, and I am defining it in the following way:

<local:ColumnPickerControl x:Name="PART_SimpleFilterMemberComboBox" telerik:StyleManager.Theme="{StaticResource Theme}"
Margin="0,0,3,0" MinWidth="100" VerticalAlignment="Center"
DataFilter="{Binding x:ElementName=RadDataFilter, IsAsync=True}"
RadSimpleFilterVM="{Binding SimpleFilter, Mode=OneWay, IsAsync=True}" />

Hope this helps..
0
Pete
Top achievements
Rank 1
answered on 22 Jan 2013, 08:18 AM
Finally got it working - it's not very straight forward though.

The problem is that the ItemPropertyDefinitions are converted at runtime into ItemPropertyDefinitionViewModels and added to a SimpleFilterViewModel for the FilterControl (inside the RadDataFilter control).

The SimpleFilter view model has a SelectedMember property and an AvailableMembers collection. When you set the SelectedMember property it must be an item in the AvailableMembers list.

This means that if you inherit from ItemPropertyDefinition and add a Children collection (as I have), at runtime the items in Children are not converted into ItemPropertyDefinitionViewModels and not added to the AvailableMembers list.

To get around this I have to add all the child items a ItemPropertyDefinitions collection on the RadDataFilter and filter them out of the itemsource for the treeview using a converter. This also means that the binding to SelectedMember will not work as any child item in the tree will not be available in the AvailableMembers list. To overcome this I have to have two behaviors - one for when the dropdownbutton is opened (to set the selected item), and another for the TreeView when the selection is changed (to set the SimpleFilter.SelectedMember).

It's pretty complicated really for something that seems like it should be simple. Hopefully this explanation will help someone else from going through the full process that I have to try and solve this problem!
Tags
DataFilter
Asked by
Pete
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Shankar
Top achievements
Rank 1
Pete
Top achievements
Rank 1
Share this question
or