0

I've added a reference to an app resource in my View's window. But when I declare the resource I get the error:

Error   10  RegexValidationRule is not supported in a Windows Presentation Foundation (WPF) project.

This is how I added the resource to the View:

  <Window.Resources>
        <validators:RegexValidationRule x:Key="localRegexValidationRule"/>
    </Window.Resources>

Does anyone know how to reference the resource correctly in WPF?

I've followed this solution but still get the same error on the resource. This is how I've declared the resource in app.xaml within a resource dictionary:

<Application x:Class="MongoDBApp.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:converters="clr-namespace:MongoDBApp.Converters"
             xmlns:validators="clr-namespace:MongoDBApp.Validators"
             StartupUri="pack://application:,,,/Views/MainView.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <converters:BoolToNonVisibilityConverter x:Key="localBoolToNonVisibilityConverter" />
            <converters:BoolToVisibilityConverter x:Key="localBoolToVisibilityConverter" />
            <validators:RegexValidationRule x:Key="localRegexValidationRule" />
        </ResourceDictionary>
    </Application.Resources>
</Application>
Community
  • 1
  • 1
Brian Var
  • 6,029
  • 25
  • 114
  • 212
  • What about that validator? (validators:RegexValidationRule) Sounds like it is compiled somehow strange. Do you use Blend? ('cause I Googled and found: http://dotnetgui.blogspot.hu/2012/02/expression-blend-bugcant-open.html) – Jettero Nov 17 '15 at 21:51

1 Answers1

1

Have you added the appropriate using statement in your View file? It should have the same statement as your App.xaml file:

         xmlns:validators="clr-namespace:MongoDBApp.Validators"
Harriet
  • 97
  • 3