This project is read-only.

Partial declarations of 'WpfApplication2.MainWindow' must not specify different base classes

Oct 17, 2013 at 7:53 AM
Hi,

Trying to build a normal Elysium metro styled application.
I did exactly as shown in the documentation.

got following error :
Error   1   Partial declarations of 'WpfApplication2.MainWindow' must not specify different base classes    C:\Users\arun_sharma10\Documents\Visual Studio 2012\Projects\WpfApplication2\WpfApplication2\MainWindow.xaml.cs 21  33  WpfApplication2
Error   2   The type 'WpfApplication2.MainWindow' already contains a definition for '_contentLoaded'    C:\Users\arun_sharma10\Documents\Visual Studio 2012\Projects\WpfApplication2\WpfApplication2\obj\Debug\App.g.cs 42  22  WpfApplication2
Error   3   Type 'WpfApplication2.MainWindow' already defines a member called 'InitializeComponent' with the same parameter types   C:\Users\arun_sharma10\Documents\Visual Studio 2012\Projects\WpfApplication2\WpfApplication2\obj\Debug\App.g.cs 49  21  WpfApplication2
and here is the xaml code behind :
namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public sealed partial class MainWindow : System.Windows.Application
    {
        private void StartupHandler(object sender, System.Windows.StartupEventArgs e)
        {
            Elysium.Manager.Apply(this, Elysium.Theme.Dark, Elysium.AccentBrushes.Blue, Elysium.AccentBrushes.Blue);
        }
  
    }
}
MainWindow.xaml:
<metro:Window x:Class="WpfApplication2.MainWindow" 
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:metro="http://schemas.codeplex.com/elysium"
              xmlns:params="http://schemas.codeplex.com/elysium/params"
              params:Manager.Theme="Dark"
              params:Manager.AccentBrush="{x:Static metro:AccentBrushes.Blue}"
              params:Manager.ContrastBrush="White"
              Background="{DynamicResource BackgroundBrush}">


</metro:Window>
    

App.xaml:
<Application x:Class="WpfApplication2.MainWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml" Startup="StartupHandler">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Elysium;component/Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
Oct 18, 2013 at 1:41 AM
Edited Oct 18, 2013 at 1:42 AM
If you change base class in your XAML code (to metro:Window, in this case), you need to change base class in your C# code too. Change definition
public sealed partial class MainWindow : System.Windows.Application
to
public sealed partial class MainWindow : Elysium.Controls.Window
or remove it (base class can be declared only once for partial classes):
public sealed partial class MainWindow
See documentation for more detailed information about partial classes.