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

RadTreeViewItem and object validation

4 Answers 36 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Miłosz Cechnicki
Top achievements
Rank 1
Miłosz Cechnicki asked on 07 Mar 2011, 09:22 AM
Hi,

I'm using in my Silverlight application INotifyDataErrorInfo interface for managing object's validation errors.
I also need to show this validation error info in a TreeView, and here is my question:

Is it possible to define a style, that supports such a behavior? I tried to achieve it in some ways, but I can't get it working.

Thank You for any help in advance,

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 09 Mar 2011, 05:46 PM
Hi Miłosz Cechnicki,

You can check out the attached project which demonstrates a RadTreeView with editablle treeviewitem`s Headers. In the editable header template there is a textbox with its text bound to a ViewModel that implements INotifyDataErrorInfo. Hope you may find it useful. You can also check out our new suite of MaskedInput controls here. They will be officially released with the upcoming telerik Q1 2011 Release.

All the best,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Miłosz Cechnicki
Top achievements
Rank 1
answered on 11 Mar 2011, 11:41 AM
Hi,
Thank You for a example.
So I assume, that it's impossible to display error info for a object at a RadTreeViewItem level? I'm displaying in the tree items, which templates' consist of some images, textBlocks and some other elements. And what I want to achieve is to show the binded object's error to the user. All of this controls are not editable, it is only possible to edit objects properties in specialized windows, and the tree is only for having a quick view at which item's are in error state.

If there is no way to do this at the ItemContainerStyle level (for example) then I'll prepare some kind of data template, that will indicate that errors. But it would be much move convenient to implement it at the style level.

Best regards
0
Petar Mladenov
Telerik team
answered on 16 Mar 2011, 03:00 PM
Hi Miłosz Cechnicki,

I think you can use StyleSelector class and to make validation before you apply different styles to the RadTreeViewItems. Could you please examine the attached project and let me know if it satisfies you ?

Kind regards,
Petar Mladenov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Miłosz Cechnicki
Top achievements
Rank 1
answered on 17 Mar 2011, 05:21 PM
Hi,

Thank You for Your help.

After some time we succeeded with implementing such a behavior at a ItemContainerStyle level.

Maybe this description will be useful for someone else:
The only requirement for this solution to work, is that object binded to such ListBox / TreeView inherits from our base class, or just simply has to properties: HasErrors and ErrorsSummary, that return all the errors reported to all properties of the object. And depending on this two properties the error border is displayed with an toolTip added to it, that show the error description.

Best regards
Tags
TreeView
Asked by
Miłosz Cechnicki
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Miłosz Cechnicki
Top achievements
Rank 1
Share this question
or