Using ContentTemplateSelector with RadOutlookBar

2 posts, 0 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 03 Feb 2010 Link to this post

    I have a template selector defined as follows...




    <local:MyContentTemplateSelector x:Key="contenttemplateselector" />  

    public class MyContentTemplateSelector : Telerik.Windows.Controls.DataTemplateSelector  
    public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)  
    if (object.ReferenceEquals(item, container))  
    return null;  
    MyOutlookBarItem i = item as MyOutlookBarItem;  
    if ((i.iTitleString.Contains("1")) || (i.iTitleString.Contains("3")) || (i.iTitleString.Contains("5")))  
    return App.Current.Resources["contenttemplate1"] as DataTemplate;  
    return App.Current.Resources["contenttemplate2"] as DataTemplate;  





    And my RadOutlookBar defined like this...

    <RadNav:RadOutlookBar ContentTemplateSelector="{StaticResource contenttemplateselector}">  

    Everything seems to work fine as I switch between items, until I hit an item for the second time I hit any item.  I get a "Argument Exception - Value is out of range error".  Any thoughts?
  2. Kiril Stanoev
    Kiril Stanoev avatar
    1512 posts

    Posted 05 Feb 2010 Link to this post

    Hi Rob,

    Unfortunately I was not able to reproduce the issue you describe. I am attaching my test project for reference. Could you please have a look at it and let me know if I am doing anything wrong. If you manage to reproduce the issue with my test project, could you please tell me the exact steps to reproduce it. I'd be glad to further assist you.

    Best wishes,
    Kiril Stanoev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top