This question is locked. New answers and comments are not allowed.
Calin Calin
Top achievements
Rank 1
Calin Calin
asked on 22 Jul 2010, 05:09 PM
Hi,
I have to questions suggestions:
1. I will want to define the properties the filter works on (for example taking and Person object that has a name and a age, I want to tell the filter to use the name property only)
2. I will like to define a set of values for the filter properties, for example: taking the object Person that has the property Sex I want define the set of values ('male' and 'female').
Thank you,
I have to questions suggestions:
1. I will want to define the properties the filter works on (for example taking and Person object that has a name and a age, I want to tell the filter to use the name property only)
2. I will like to define a set of values for the filter properties, for example: taking the object Person that has the property Sex I want define the set of values ('male' and 'female').
Thank you,
4 Answers, 1 is accepted
0
Hi Calin Calin,
1. You can do that. There is a property called ItemProperties. It can only be used when the filter is in unbound mode, i.e. has no Source defined, because if it has a Source defined, then it automatically extracts the properties from there. There even is an online example that demonstrates the ItemProperties property.
2. You can do that as well. The feature is called Custom Editors. You have two options.
A) You can specify a completely new control to be the editor in case the stock one is not enough. This is done through the so-called EditorTemplateSelector which is a property of the controls. A demo of this can be seen in this example, the first filter that says "Crab Meat". We have replaced the default editor for strings which is a TextBox with a completely new editor which is a RadComboBox. Then we have set the ItemsSource of the combo-box in the EditorLoaded event. The thing to remember here is that you have to bind your editor's respective property to our ViewModel's "Value" property, like demonstrated in the example.
B) In case the stock control is ok for you but you simply need to change it a little bit, this can be done in the EditorCreated event. A demo of this can be seen in the same example as above but in the second filter which shows the time instead of the date. This is our default editor for DateTime values (RadDataTimePicker), but its mode was changed to Time.
The combination of the EditorTemplateSelector and the EditorLoaded event will provide you with endless possibilities.
I hope this helps. Let me know if you have any other questions.
Best wishes,
Ross
the Telerik team
1. You can do that. There is a property called ItemProperties. It can only be used when the filter is in unbound mode, i.e. has no Source defined, because if it has a Source defined, then it automatically extracts the properties from there. There even is an online example that demonstrates the ItemProperties property.
2. You can do that as well. The feature is called Custom Editors. You have two options.
A) You can specify a completely new control to be the editor in case the stock one is not enough. This is done through the so-called EditorTemplateSelector which is a property of the controls. A demo of this can be seen in this example, the first filter that says "Crab Meat". We have replaced the default editor for strings which is a TextBox with a completely new editor which is a RadComboBox. Then we have set the ItemsSource of the combo-box in the EditorLoaded event. The thing to remember here is that you have to bind your editor's respective property to our ViewModel's "Value" property, like demonstrated in the example.
B) In case the stock control is ok for you but you simply need to change it a little bit, this can be done in the EditorCreated event. A demo of this can be seen in the same example as above but in the second filter which shows the time instead of the date. This is our default editor for DateTime values (RadDataTimePicker), but its mode was changed to Time.
The combination of the EditorTemplateSelector and the EditorLoaded event will provide you with endless possibilities.
I hope this helps. Let me know if you have any other questions.
Best wishes,
Ross
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 22 Jul 2010, 07:23 PM
Hi Ross,
Thank you very much for your answers.
1. Is sad that there is so much code behind required, I will prefer a method that takes advantage of the xaml features. More like defining the properties like you define the column for the GridView for example. Is this any-ware in the planning for the near future ?
2. The example is very useful, just what I was looking for.
Regards,
Thank you very much for your answers.
1. Is sad that there is so much code behind required, I will prefer a method that takes advantage of the xaml features. More like defining the properties like you define the column for the GridView for example. Is this any-ware in the planning for the near future ?
2. The example is very useful, just what I was looking for.
Regards,
0
Hello Calin Calin,
I have logged your suggestion as a feature request:
Issue ID 2809 - Declarative definition of item properties.
You can vote for this feature here.
Kind regards,
Ross
the Telerik team
I have logged your suggestion as a feature request:
Issue ID 2809 - Declarative definition of item properties.
You can vote for this feature here.
Kind regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 23 Jul 2010, 09:01 AM
Thank you Ross