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

Using ContentTemplateSelector with RadOutlookBar

1 Answer 111 Views
OutlookBar
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 03 Feb 2010, 04:32 PM

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;  
}  
else  
{  
return App.Current.Resources["contenttemplate2"] as DataTemplate;  
}  
}  
}  
 
 

 

 

 

 

And my RadOutlookBar defined like this...

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


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?

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 05 Feb 2010, 04:12 PM
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.
Tags
OutlookBar
Asked by
Rob
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or