I'm trying to overwrite some Modern UI templates. In this particular example I'm trying to put my own logo to ModernWindow with link to my web site. So, I added ModernWindow ResourceDictionary to my Themes folder like this:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:modernui="http://firstfloorsoftware.com/ModernUI"
xmlns:resources="clr-namespace:FirstFloor.ModernUI;assembly=FirstFloor.ModernUI">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/Button.xaml" />
<ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/Converters.xaml" />
<ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/TextBlock.xaml" />
<ResourceDictionary Source="/MyProject;component/Themes/MyModernMenu.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="modernui:ModernWindow" x:Key="MyModernWindow">
...
<!-- main menu -->
<modernui:ModernMenu Grid.Column="1"
SelectedSource="{Binding Source, ElementName=ContentFrame, Mode=TwoWay}"
LinkGroups="{TemplateBinding MenuLinkGroups}" Style="{StaticResource MyModernMenu}"/>
<TextBlock Grid.Column="3" Margin="-130,0,0,0">
Powered by <Hyperlink x:Name="Link" NavigateUri="WWW.MyWebSite.com" RequestNavigate="Link_RequestNavigate">
<Image Source="pack://application:,,,/Content/Images/MyLogo.png" Height="16" Width="55" Margin="0,0,0,-5"></Image>
</Hyperlink>
</TextBlock>
...
</Style>
</ResourceDictionary>
Then in my CodeBehind I have this class for this ResourceDictionary:
namespace MyProject.Themes
{
class MyModernWindow : ModernWindow
{
}
}
This inherited from ModernWindow, which inherited from ModernWindow : DpiAwareWindow
, which inherited from DpiAwareWindow : Window
. So if I will just put x:class in my XAML like this:
x:Class="Elite3EDataExtractor.Themes.MyModernWindow"
Then I'm getting
Missing partial modifier on declaration of type 'MyProject.Themes.MyModernWindow'; another partial declaration of this type exists
As I read in these questions:
Is it possible to set code behind a resource dictionary in WPF for event handling?
and
Partial declarations must not specify different base classes
I'm missing some rules for Window Inheritance. I'm kinda new in WPF, so please, can someone help me figure this out. What should I add/change in order to keep ModernUI ModernWindow functionality working and be able to add event handlers to MyModernWindow.xaml.cs
. Please, let me know if I should put more code or explanation here.
Thanks