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

ItemTemplateSelector not working

3 Answers 176 Views
OutlookBar
This is a migrated thread and some comments may be shown as answers.
Johannes
Top achievements
Rank 1
Johannes asked on 15 Sep 2015, 09:32 AM
I am trying to use ItemTemplateSelector for RadOutlookBar because I want the selected Item to ​look different from the non selected. Using ItemTemplate works fine but when I use an ItemTemplateSelector the constructor for ​​that custom DataTemplateSelector is called but method SelectTemplate is never called. I am using Version 2013.3.1316.45.

3 Answers, 1 is accepted

Sort by
0
Johannes
Top achievements
Rank 1
answered on 15 Sep 2015, 09:36 AM

Here's my Control:

 

<telerik:RadOutlookBar ItemsSource="{Binding OutlookBarControlViewModel.Items, Mode=OneWay}" SelectedItem="{Binding OutlookBarControlViewModel.CurrentItem, Mode=TwoWay}" Style="{StaticResource RadOutlookBarStyle}">
  <telerik:RadOutlookBar.ItemTemplateSelector>
    <local:OutlookBarItemTemplateSelector>
      <local:OutlookBarItemTemplateSelector.CurrentItemDataTemplate>
        <DataTemplate>
        ...
        </DataTemplate>
      </local:OutlookBarItemTemplateSelector.CurrentItemDataTemplate>
      <local:OutlookBarItemTemplateSelector.ItemDataTemplate>
        <DataTemplate>
          ...
        </DataTemplate>
      </local:OutlookBarItemTemplateSelector.ItemDataTemplate>
    </local:OutlookBarItemTemplateSelector>
  </telerik:RadOutlookBar.ItemTemplateSelector>
</telerik:RadOutlookBar>

0
Peshito
Telerik team
answered on 18 Sep 2015, 08:38 AM
Hello Johannes,

Thank you for providing the code for the issue. I will take a look and check whether this is indeed an issue and will let you know with more information on the matter.

Regards,
Peshito
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peshito
Telerik team
answered on 18 Sep 2015, 12:47 PM
Hi Johannes,

After investigating this issue, it seems that you have hit a bug. I logged it in our Feedback Portal and you can track its progress and also give your vote using the link below:
http://feedback.telerik.com/Project/143/Feedback/Details/169682-itemtemplateselector-does-not-work

In the meantime there is a workaround you could use. You should edit control's template and update the HeaderElement ContentControl where the ContentTemplateSelector should be as follows:
<ContentControl x:Name="HeaderElement" Margin="3 0 0 0"
                                                             FontWeight="{TemplateBinding FontWeight}"
                                                             FontSize="{TemplateBinding FontSize}"
                                                             Content="{TemplateBinding Header}"
                                                             ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                             HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                             VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                             Foreground="{TemplateBinding Foreground}"
                                                             IsTabStop="False" >
                                                                                                             <ContentControl.ContentStringFormat>{TemplateBinding HeaderStringFormat}</ContentControl.ContentStringFormat>
                                                <ContentControl.ContentTemplateSelector>{TemplateBinding HeaderTemplateSelector}</ContentControl.ContentTemplateSelector>
                                                <ContentControl.SnapsToDevicePixels>True</ContentControl.SnapsToDevicePixels>
                                          
                                  </ContentControl>
As a gratitude to this finding your Telerik points are now updated. Thank you for reporting this!

Regards,
Peshito
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
OutlookBar
Asked by
Johannes
Top achievements
Rank 1
Answers by
Johannes
Top achievements
Rank 1
Peshito
Telerik team
Share this question
or