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

3 posts, 0 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 24 Sep 2010 Link to this post

    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. Dani
    Admin
    Dani avatar
    848 posts

    Posted 30 Sep 2010 Link to this post

    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
  3. DevCraft banner
  4. Dani
    Admin
    Dani avatar
    848 posts

    Posted 20 Oct 2010 Link to this post

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