Frage

I just want to create application defined Style:

<Application x:Class="Customer_UI.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">

    <Application.Resources>
        <style>
        </style>
    </Application.Resources>
</Application>

ERROR: style is not supported in a Windows Presentation Foundation (WPF) project

War es hilfreich?

Lösung

Firstly, try write Style tag like this: <Style ... />. Secondly, you must add TargetType or the Key for your Style, because ResourcesDictionary it is a Dictionary and there is can not be elements without the key. The Key in this case it's a hash, what needed for not ordered Dictionary.

Example:

<Application.Resources>
    <Style TargetType="{x:Type FrameworkElement}">

    </Style>
</Application.Resources>

For more information, see this:

MSDN: Styling and Templating

Andere Tipps

<Application x:Class="Customer_UI.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         StartupUri="MainWindow.xaml">
    <Application.Resources>
       <Style>
       </Style>
    </Application.Resources>
</Application>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top