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

ItemMinimizedTemplate not working

2 Answers 144 Views
OutlookBar
This is a migrated thread and some comments may be shown as answers.
sunu
Top achievements
Rank 1
sunu asked on 11 Nov 2009, 11:05 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 11 Nov 2009, 11:50 AM
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.
0
sunu
Top achievements
Rank 1
answered on 13 Nov 2009, 07:58 AM
hi
thanks. it works

Regrads
SUNU
Tags
OutlookBar
Asked by
sunu
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
sunu
Top achievements
Rank 1
Share this question
or