Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silly F#\WPF error - "The Name 'abc' does not exist in the namespace 'xyz'" even though Intellisense sees it

Trying to migrate from C# to F# (and my first time using MVC instead of MVVM, so my terminology may be off), but ultimately I'm unable to get my WPF\XAML DataContext set up, so I can bind my UI.

I have the following simple WPF:

<UserControl x:Class="epic.Sandbox.Controls.FieldController"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:epic.Sandbox.Controls"
             xmlns:Views="clr-namespace:epic.View;assembly=epic.Core"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.DataContext>
        <Views:TextFieldModel />
    </UserControl.DataContext>
    <Grid>

    </Grid>
</UserControl>

and the following F#:

namespace epic.View

open System
open FSharp.Desktop.UI

[<AbstractClass>]
type public FieldModelBase() = 
    inherit Model() 

    let mutable fieldCaption: string = null
    let mutable fieldValue: System.Object = null
    [<DerivedProperty>]
    member this.Caption with public get() = sprintf "%s" fieldCaption and set value = fieldCaption <- sprintf "%s" value; this.NotifyPropertyChanged "Caption"
    [<DerivedProperty>]
    member this.Value with public get() = fieldValue and set value = fieldValue <- value; this.NotifyPropertyChanged "Value"

type public TextFieldModel() =
    inherit FieldModelBase()

The XAML editor's Intellisense DOES see my class, as you can see from the following screenshot: Cropped

But when I try to compile, I receive the following error: Cropped2

Any idea what I'm doing wrong?

like image 693
turkinator Avatar asked Oct 19 '22 06:10

turkinator


1 Answers

Thanks to the comment from @Terrance, I manually deleted my "\bin" folder from the WPF solution, restarted Visual Studio and rebuilt my solution. Problem solved. Silly me.

like image 179
turkinator Avatar answered Oct 21 '22 04:10

turkinator