ItemTemplateSelector not working

4 posts, 0 answers
  1. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 15 Sep 2015 Link to this post

    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.
  2. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 15 Sep 2015 Link to this post

    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>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 18 Sep 2015 Link to this post

    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
  5. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 18 Sep 2015 Link to this post

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