Stardusty

Error : 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute specified on the root element tag.

Hi,

I get this error when i include some namespaces in my ResourceDictionary to specify a Style for a custom control.
Can anyone help me

Thx

Stardusty



Re: Windows Presentation Foundation (WPF) 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

NoSuchThingAs2

Here's a resource dictionary where I pull in 2 namespaces and use them. Could you post your code


Code Snippet

e done some of that stuff before and might be able to help. Could you post your code Here's a resource dictionary where I pull in an external library:

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:valueConverters="clr-namespace:JBSi.TitleIVE.Windows.Controls.ValueConverters"
xmlns:datePicker="clr-namespace:Microsoft.Samples.KMoore.WPFSamples.DateControls;assembly=WPFSamplesLib"
>
<valueConverters:InvertBooleanConverter x:Key="InvertBooleanConverter" />
<Style TargetType="{x:Type datePicker:DatePicker}">
<Setter Property="CanEdit" Value="True" />
</Style>
</ResourceDictionary>





Re: Windows Presentation Foundation (WPF) 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

Yi-Lun Luo - MSFT

Hello, why do you want to use x:TypeArguments on a ResourceDictionary This is not allowed. x:TypeArguments should only be used on generic root types such as PageFunction, and you must have a code behind class. Please have a look at http://msdn2.microsoft.com/en-us/library/ms750476.aspx.






Re: Windows Presentation Foundation (WPF) 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

Stardusty

Hi,

That's the whole point. I don't want to use x:TypeArguments on a ResourceDictionary but the compiler says it needs it.

And i don't know why.

This code give no error:

<ResourceDictionary

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:sys="clr-namespaceTongue Tiedystem;assembly=mscorlib">

</ResourceDictionary>

And by adding 3 namespaces it gives that weard error:

<ResourceDictionary

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:controls="clr-namespace:MyTime.View.Controls"

xmlns:converters="clr-namespace:MyTime.View.Converters"

xmlns:validationrules="clr-namespace:MyTime.View.ValidationRules"

xmlns:sys="clr-namespaceTongue Tiedystem;assembly=mscorlib">

</ResourceDictionary>





Re: Windows Presentation Foundation (WPF) 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

Mr. Wonderful

Did you ever get an answer Please reply if you did. Thanks!






Re: Windows Presentation Foundation (WPF) 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

RalfJuergensen

I have the same problem here. I'm using PageFunction<bool> and it won't compile the xaml code.

I have to remove all PageFunction<bool> derived classes from the project to compile the xaml then add the PageFunctions to the project and then it works. Quite awkward :-(





Re: Windows Presentation Foundation (WPF) 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

Nathan Allan

Hello,

We've had the experience that if a clr-namespace: mapping is used when there is an existing URI based mapping, we get this error. The work-around seems to be to use the URI namespace.

Best,

--

Nathan Allan





Re: Windows Presentation Foundation (WPF) 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

Taco H. in den Bosch

In my case this was caused by a user control that inherited from a generic base class using the x:TypeArguments attribute. The problem went away after adding an x:Class="<resource dictionary name>" to the resource dictionary, where the dictionary name can be anything.