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

Data Filter to string and back again

2 Answers 67 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 02 Feb 2012, 05:20 PM
Is there an easy method for converting the CompositeFilterViewModel to a string and back again?

I can get the string from the CompositeFilterViewModel using ToString but I can't find an easy to convert it back again

Thanks
Chris.

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 02 Feb 2012, 05:28 PM
Hello,

Maybe you are referring to a CompositeFilterDescriptor and not the view model which is for internal use only. Even if you were able to convert a string to a view model -- you can't do anything with it after that. This is one of our internal parts. It is public because Silverlight wants it to be, but you can treat it as an internal class.

The real information holder here is the CompositeFilterDescriptor class which is public and you can use it for anything. It simply holds filtering criteria/information -- i.e. other CompositeFilterDescriptors or simple (leaf) FilterDescriptors. It is a kind of a property bag of sort.

Anyway, I am afraid that converting to a string is a one-way process only. I have written it to help me when I am debugging, that's all. It does not follow any special format or something. It is for debugging purposes only.

Of course, you can implement your custom parser that would parse such a string and then use the public API to re-construct the filter descriptor.

In fact your task is to take a .NET object, serialize it to something and then deserialize it back. This can be done in many different ways in Silverlight and is beyond the scope of Telerik support.

I hope this helps.

Greetings,
Ross
the Telerik team

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

0
Chris
Top achievements
Rank 1
answered on 02 Feb 2012, 05:35 PM
Thanks for the reply.

I am trying to use the DataFilter not bound to anything so wanted the filter so I could use it and then if the wanted to change it by displaying the data filter populated again.

Chris
Tags
DataFilter
Asked by
Chris
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Chris
Top achievements
Rank 1
Share this question
or