wpf - 愚蠢的 F#\WPF 错误 - 命名空间 "The Name ' 中不存在 'xyz' abc',即使 Intellisense 看到它

标签 wpf xaml model-view-controller f#

尝试从 C# 迁移到 F#(我第一次使用 MVC 而不是 MVVM,所以我的术语可能会关闭),但最终我无法设置我的 WPF\XAML DataContext,所以我可以绑定(bind)我的 UI。

我有以下简单的 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>

和以下 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()

XAML 编辑器的 Intellisense 确实看到了我的类(class),您可以从以下屏幕截图中看到:
Cropped

但是当我尝试编译时,我收到以下错误:
Cropped2

知道我做错了什么吗?

最佳答案

感谢@Terrance 的评论,我从 WPF 解决方案中手动删除了我的“\bin”文件夹,重新启动了 Visual Studio 并重建了我的解决方案。问题解决了。傻我。

关于wpf - 愚蠢的 F#\WPF 错误 - 命名空间 "The Name ' 中不存在 'xyz' abc',即使 Intellisense 看到它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38214496/

相关文章:

c# - 基本 WPF 验证和数据绑定(bind)

python-3.x - 使用 tkinter、MVC 和 Observables 设置 Entry 的值

wpf - 输入文本时 DatePicker.SelectedDate 不改变

c# - 在 C# 中读取 shapefile 坐标

wpf - WPF多列 ListView 的最佳方法

wpf - 在 WPF XAML 中缩放复杂的 SVG 路径

.net - 图像 UriSource 和数据绑定(bind)

php - 需要有关我的 PHP MVC 框架正确流程的指导

java - 是否可以一次将遗留 servlet 移植到框架一个组件?

wpf - 如何制作垂直均匀网格