Hi!
I would like to write a class that inherits from RibbonWindow.
In my new class I would like to have a few buttons at the bottom of a dockpanel.
The rest of the dockpanel should be filled with what he user defines later.
My class looks like this:I defined a style in Themes\generic.xaml resource of the assembly like this: In another assembly I tried to use this class in XAML like this: When this window is shown all the entire content is black.
When I derive from Window instead of RibbonWindow the content is also black, but I can see at least the windows title bar.
So, is there a way to derive from RibbonWindow?
[Modified at 05/02/2009 08:40 AM]
I would like to write a class that inherits from RibbonWindow.
In my new class I would like to have a few buttons at the bottom of a dockpanel.
The rest of the dockpanel should be filled with what he user defines later.
My class looks like this:
namespace helic.Wpf { public class DerivedRibbonWindow : RibbonWindow { static DerivedRibbonWindow() { DefaultStyleKeyProperty.OverrideMetadata( typeof(DerivedRibbonWindow), new FrameworkPropertyMetadata(typeof(DerivedRibbonWindow))); } public DerivedRibbonWindow() { } } }
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:helic.Wpf"> <Style TargetType="{x:Type local:DerivedRibbonWindow}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:DerivedRibbonWindow}"> <DockPanel LastChildFill="True" > <!-- these are the buttons to be displayed in every DerivedRibbonWindow --> <StackPanel Orientation="Horizontal"> <Button>My Button</Button> <Button>My Button</Button> <Button>My Button</Button> </StackPanel> <!-- this is where the content should go! --> <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"/> </DockPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary>
<my:DerivedRibbonWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon" xmlns:my="http://schemas.comline-ag.de/winfx"> <TextBlock>Hello world</TextBlock> </my:DerivedRibbonWindow>
When I derive from Window instead of RibbonWindow the content is also black, but I can see at least the windows title bar.
So, is there a way to derive from RibbonWindow?
[Modified at 05/02/2009 08:40 AM]
