Hi All,
I have a few classes that define the datacontext for controls in the RibbonView:
And I have several HierarchicalDataTemplates that define how the classes are visualized (modeled after the samples on this site):
How can I create the RadRibbonGroup/RadRibbonTab controls in the templates, instead of using a TextBlock? I need to do this so that I can bind to IsEnabled to dynamically enable/disable groups. The RadRibbonTab seems to take the output of the template and put it in the group header instead of the actual RadRibbonGroup control. By contrast, the headered controls in the rest of WPF have HeaderTemplate property for headers and ItemTemplate property for items.
I have a few classes that define the datacontext for controls in the RibbonView:
public class RibbonElement
{
public string Text { get; set; }
public bool IsEnabled { get; set; }
}
public class Tab : RibbonElement
{
public ObservableCollection<
Group
> Groups { get; set; }
}
public class Group : RibbonElement
{
public ObservableCollection<
Button
> Buttons { get; set; }
}
public class Button : RibbonElement
{
}
And I have several HierarchicalDataTemplates that define how the classes are visualized (modeled after the samples on this site):
<
DataTemplate
x:Key
=
"ButtonTemplate"
>
<
t:RadRibbonButton
Text
=
'{Binding Text}'
IsEnabled
=
'{Binding IsEnabled}'
/>
</
DataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"GroupTemplate"
ItemsSource
=
'{Binding Buttons}'
ItemTemplate
=
'{StaticResource ButtonTemplate}'
>
<
TextBlock
Text
=
'{Binding Text}'
/>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"TabTemplate"
ItemsSource
=
'{Binding Groups}'
ItemTemplate
=
'{StaticResource GroupTemplate}'
>
<
TextBlock
Text
=
'{Binding Text}'
/>
</
HierarchicalDataTemplate
>
</
Window.Resources
>
<
t:RadRibbonView
ItemsSource
=
'{Binding Tabs}'
ItemTemplate
=
'{StaticResource TabTemplate}'
ApplicationButtonVisibility
=
"Hidden"
/>
How can I create the RadRibbonGroup/RadRibbonTab controls in the templates, instead of using a TextBlock? I need to do this so that I can bind to IsEnabled to dynamically enable/disable groups. The RadRibbonTab seems to take the output of the template and put it in the group header instead of the actual RadRibbonGroup control. By contrast, the headered controls in the rest of WPF have HeaderTemplate property for headers and ItemTemplate property for items.