How to clear the error "... is not a valid value for property ..."

93 views Asked by At

I'm creating a WPF application and I've created a UserControl for buttons that navigate from one page to another.

My program runs fine but I have errors being shown in VS that should prevent my program from compiling but doesn't.

Severity    Code    Description File    Line    Suppression State
Error XDG0010 'Microsoft.VisualStudio.XSurface.Wpf.Page' is not a valid value for property 'Page'.  
C:\Users\...\Desktop Front End\Views\Windows\Main.xaml  29  

In my Main.xaml file I have the following code.

...
xmlns:local="clr-namespace:Desktop_Front_End.Views.Windows"
xmlns:controls="clr-namespace:Desktop_Front_End.Resources.UserControls"
xmlns:pages="clr-namespace:Desktop_Front_End.Views.Pages"
...
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,2,0,2">
    <controls:btnNav PathData="{StaticResource VecBuilding}" 
                     Description="UI Demo"
                     Nav_Click="_Nav_Click">
            
         <controls:btnNav.Page >
             <pages:UiTheme />
         </controls:btnNav.Page>
     </controls:btnNav>
     <controls:btnNav PathData="{StaticResource VecBuilding}" 
...

In my UserControl I have the following:

    public static readonly DependencyProperty PageProperty = DependencyProperty.Register(
        "Page", typeof(Page), typeof(btnNav), new PropertyMetadata(null));
    public dynamic Page
    {
        get { return GetValue(PageProperty); }
        set { SetValue(PageProperty, value); }
    }

I've tried adjusting public dynamic Page to public Page Page but when I do this my program does not compile.

How do I get rid of these error in Visual Studio?

0

There are 0 answers