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?