ItemMinimizedTemplate not working

3 posts, 1 answers
  1. sunu
    sunu avatar
    19 posts
    Member since:
    Jun 2009

    Posted 11 Nov 2009 Link to this post


    Hi
    I have added ItemMinimizedTemplate along with ItemTemplate and Title Template.  
    <telerikNavigation:RadOutlookBar.ItemMinimizedTemplate> 
                    <DataTemplate> 
                        <Grid> 
                            <TextBlock Text="{Binding Label}" FontWeight="Bold" FontSize="24"/>  
                        </Grid> 
                    </DataTemplate> 
                </telerikNavigation:RadOutlookBar.ItemMinimizedTemplate> 

    But whenever, i have tried to minimize the outlookbar control, it shows an error
    InnerException = {System.NotSupportedException: ItemsControl.Items must not be a UIElement type when an ItemTemplate is set.
       at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.GetContainerForItem(Object item)
       at System.Windows.Controls.ItemC...


    Please find the source code for your refrence and let me know a solution to resolve this issue.

    Xaml
    <UserControl x:Class="SilverlightApplication1.MainPage" 
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:local="clr-namespace:SilverlightApplication1" 
            xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation">  
        <UserControl.Resources> 
            <local:MyItemsSource x:Key="myItemsSource" /> 
        </UserControl.Resources> 
        <Grid x:Name="LayoutRoot" Height="300" Width="400">  
            <telerikNavigation:RadOutlookBar x:Name="outlookbar" 
                    ItemsSource="{StaticResource myItemsSource}">  
                <telerikNavigation:RadOutlookBar.ItemTemplate> 
                    <DataTemplate> 
                        <Grid> 
                            <TextBlock Text="{Binding Label}" Cursor="Hand" /> 
                        </Grid> 
                    </DataTemplate> 
                </telerikNavigation:RadOutlookBar.ItemTemplate> 
                  
                <telerikNavigation:RadOutlookBar.TitleTemplate> 
                    <DataTemplate> 
                        <Grid> 
                            <TextBlock Text="{Binding Label}" FontWeight="Bold" FontSize="24"/>  
                        </Grid> 
                    </DataTemplate> 
                </telerikNavigation:RadOutlookBar.TitleTemplate> 
     
                <telerikNavigation:RadOutlookBar.ItemMinimizedTemplate> 
                    <DataTemplate> 
                        <Grid> 
                            <TextBlock Text="{Binding Label}" FontWeight="Bold" FontSize="24"/>  
                        </Grid> 
                    </DataTemplate> 
                </telerikNavigation:RadOutlookBar.ItemMinimizedTemplate> 
     
     
            </telerikNavigation:RadOutlookBar> 
        </Grid> 
    </UserControl> 

    C#
    using System;  
    using System.Collections.Generic;  
    using System.Linq;  
    using System.Net;  
    using System.Windows;  
    using System.Windows.Controls;  
    using System.Windows.Documents;  
    using System.Windows.Input;  
    using System.Windows.Media;  
    using System.Windows.Media.Animation;  
    using System.Windows.Shapes;  
    using Telerik.Windows.Controls;  
    using System.Collections.ObjectModel;  
     
    namespace SilverlightApplication1  
    {  
        public partial class MainPage : UserControl  
        {  
            public MainPage()  
            {  
                InitializeComponent();  
            }  
        }  
     
        public class MyItemsSource : ObservableCollection<MyItem>  
        {  
            public MyItemsSource()  
            {  
                this.Add(new MyItem() { Label = "Item 1" });  
                this.Add(new MyItem() { Label = "Item 2" });  
                this.Add(new MyItem() { Label = "Item 3" });  
                this.Add(new MyItem() { Label = "Item 4" });  
            }  
        }  
     
        public class MyItem  
        {  
            public string Label { getset; }  
        }  
    }  
     


    Regards
    SUNU
  2. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 11 Nov 2009 Link to this post

    Hi Sunu,

    We are aware of this issue and it has already been fixed. The fix will be available with our next internal release. Meanwhile you can do a small modification to RadOutlookBar's ControlTemplate, which would allow you to specify ItemMinimizedTemplate. More specifically, if you examine RadOutlookBar's ControlTemplate, you will see the following line of code:

    <Telerik_Windows_Controls_OutlookBar:MinimizedOutlookBarArea x:Name="MinimizedAreaControl" IsTabStop="False" ItemTemplate="{TemplateBinding ItemMinimizedTemplate}" telerik:RadDockPanel.Dock="Right" />

    The line that says: ItemTemplate="{TemplateBinding ItemMinimizedTemplate}" has to be removed and the above code snippet has to become:

    <Telerik_Windows_Controls_OutlookBar:MinimizedOutlookBarArea x:Name="MinimizedAreaControl" IsTabStop="False" telerik:RadDockPanel.Dock="Right" />

    I am attaching a sample project that contains the fixed version of RadOutlookBar's ControlTemplate. You can use it by the time we release our next internal binaries. Give it a try and if you still experience the same issue, let me know.

    Greetings,
    Kiril Stanoev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. sunu
    sunu avatar
    19 posts
    Member since:
    Jun 2009

    Posted 13 Nov 2009 Link to this post

    hi
    thanks. it works

    Regrads
    SUNU
Back to Top