PutraKg
PutraKg

Reputation: 2246

Adding static class into Application.Resources error

I am trying to add static class as a resources in Application.Resources

namespace MultiResImageChooser
{
public static class MultiResObjectInstance
{
    private static MultiResPropertyChanged multiResObject = new MultiResPropertyChanged();

    public static MultiResPropertyChanged current
    {
        get
        {
            return multiResObject;
        }
    }

   }
}

Then in App.xaml I have

 xmlns:static="clr-namespace:MultiResImageChooser"
 ....
<Application.Resources>
    <static:MultiResObjectInstance x:Key="MultiResObjectInstance"/>
</Application.Resources>`

But in design view, VS2012 complains that The type MultiResObjectInstance is an abstract and must include an explicit value

How do I properly include static class in App.xaml as a resource?

Upvotes: 2

Views: 1343

Answers (1)

Davut G&#252;rb&#252;z
Davut G&#252;rb&#252;z

Reputation: 5736

Note sure giving a key for it because it is static.

You can't get an instance of a static class.

I think the problem is being static already. XAML tries to get an instance of the type and can't do it so thinks it is an abstract...

Upvotes: 3

Related Questions