spiegelp / MaterialDesignExtensions

Material Design Extensions is based on Material Design in XAML Toolkit to provide additional controls and features for WPF apps
https://spiegelp.github.io/MaterialDesignExtensions/
MIT License
762 stars 122 forks source link

NotImplementedException When Using MaterialWindow #58

Closed VaslD closed 4 years ago

VaslD commented 5 years ago

Issue

I tried to prettify a regular WPF Window to MaterialWindow but encountered this error at startup:

System.Windows.Markup.XamlParseException: ''Initialization of 'Sample.WPF.FirstWindow' threw an exception.' Line number '7' and line position '6'.'

Inner Exception:
NotImplementedException: The method or operation is not implemented.

This was the XAML used, very straightforward:

<mdx:MaterialWindow x:Class="Sample.WPF.FristWindow"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Sample.WPF"
                    xmlns:mdx="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
                    Title="Hello" Height="450" Width="800">
    <Grid />
</mdx:MaterialWindow>

The code-behind had nothing other than InitializeComponent();

And I have merged the following dictionaries in App.xaml:

<Application x:Class="Sample.WPF.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:Sample.WPF"
             StartupUri="FirstWindow.xaml">

             <!--
             Startup="OnStartup"
             Exit="OnShutdown"-->

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary
                    Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/Generic.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/MaterialDesignLightTheme.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Amber.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Indigo.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

</Application>

It would've worked without using MaterialWindow, i.e. using WPF window themed by MaterialDesignToolkit alone, although not fancy enough.

Installed NuGets:

All on latest preview.

spiegelp commented 5 years ago

@VaslD Could you try the latest stable versions please?

If you still get the exception, please post the full stack trace.

bartdebever commented 4 years ago

For me what did the trick was uninstalling the preview 3.0 version of MaterialDesignThemes. On 2.6 this is all working fine.

spiegelp commented 4 years ago

I think this issue is only a non working combination of pre-releases introducing breaking changes.