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

Binding to HeaderTemplate

1 Answer 92 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 20 Jun 2011, 04:29 PM
Sorry for the simple question, but this does not work:

<telerik:RadMenuItem >
    <telerik:RadMenuItem.HeaderTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Something}" />
        </DataTemplate>
    </telerik:RadMenuItem.HeaderTemplate>
</telerik:RadMenuItem>


But this works:

<telerik:RadMenuItem Header="{Binding Something}" />

1 Answer, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 21 Jun 2011, 07:46 AM
Hello Edward ,

When you set the HeaderTemplate to DataTemplate the data context within will be the value of the Header property of the RadMenuItem. If you want to use the HeaderTemplate don't forget to set the Header.

In other words the actual value that will be displayed within the RadMenuItem is the value of the Header property and the HeaderTemplate can be used to way the Header data is displayed.

Best wishes,
Pana
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
Edward
Top achievements
Rank 1
Answers by
Pana
Telerik team
Share this question
or