RadTreeViewItem and object validation

5 posts, 0 answers
  1. Miłosz Cechnicki
    Miłosz Cechnicki avatar
    34 posts
    Member since:
    Sep 2009

    Posted 07 Mar 2011 Link to this post

    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,
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Mar 2011 Link to this post

    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!
  3. DevCraft banner
  4. Miłosz Cechnicki
    Miłosz Cechnicki avatar
    34 posts
    Member since:
    Sep 2009

    Posted 11 Mar 2011 Link to this post

    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
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 16 Mar 2011 Link to this post

    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!
  6. Miłosz Cechnicki
    Miłosz Cechnicki avatar
    34 posts
    Member since:
    Sep 2009

    Posted 17 Mar 2011 Link to this post

    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
Back to Top
DevCraft banner