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

Not sure if the "IconTemplate" property is functioning correctly?

2 Answers 42 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 24 Sep 2010, 02:20 PM
Hello,

I am having problems applying an "IconTemplate" in a RadContextMenu.  I thought at first there might be a DataContext problem but the "HeaderTemplate" property seems to be just fine....

Here is a sample piece of code to illustrate the problem:
<ToggleButton Content="Click Me" Height="100" Width="100" IsChecked="{Binding IsOpen, ElementName=rcm, Mode=TwoWay}">
   <ToggleButton.Resources>
      <DataTemplate x:Key="ht">
         <Grid>
            <Rectangle Fill="Pink" Stroke="Red" StrokeThickness="1" Height="20" Width="100" />
            <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="Goldenrod" FontSize="20" />
         </Grid>
      </DataTemplate>
      <DataTemplate x:Key="it1">
         <Grid>
            <Rectangle Fill="YellowGreen" Stroke="Green" StrokeThickness="1" Height="20" Width="20" />
            <TextBlock Text="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center" />
         </Grid>
      </DataTemplate>
      <DataTemplate x:Key="it2">
         <Grid>
            <Rectangle Fill="YellowGreen" Stroke="Green" StrokeThickness="1" Height="20" Width="20" />
            <TextBlock Text="x" VerticalAlignment="Center" HorizontalAlignment="Center" />
         </Grid>
      </DataTemplate>
   </ToggleButton.Resources>
   <telerik:RadContextMenu.ContextMenu>
      <telerik:RadContextMenu x:Name="rcm" Placement="Bottom" IconColumnWidth="50">
         <telerik:RadMenuItem Header="Item 1" Icon="1" HeaderTemplate="{StaticResource ht}" IconTemplate="{StaticResource it1}" />
         <telerik:RadMenuItem Header="Item 2" Icon="2" HeaderTemplate="{StaticResource ht}" IconTemplate="{StaticResource it2}" />
      </telerik:RadContextMenu>
   </telerik:RadContextMenu.ContextMenu>
</ToggleButton>

I have attached a picture of what I see when I run this code.  I would expect to see a "1" inside the green rectangle on item 1 but I don't....

Am I doing something incorrectly here or is this a bug?


2 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 30 Sep 2010, 10:11 AM
Hello Rob,

Thank you for your inquiry and provided code.
I apologize for the delayed answer, I hope it has not caused you significant inconveniences.

After testing, we found that this is indeed an unexpected behavior. The Icon should be able to display as text with no problem, since it is of type ContentPresenter that is properly bound in the default template of the control. We will further investigate and solve the issue.

I will update you as soon as this issue is fixed.

Thank you for the important feedback, I have updated your Telerik points.

Sincerely yours,
Dani
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Dani
Telerik team
answered on 20 Oct 2010, 10:39 AM
Hi Rob,

The issue is fixed and is available since last LIB.

Sincerely yours,
Dani
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Menu
Asked by
Rob
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or