Saturday, 7 September 2013

Name does not exist in namespace error in XAML with VB.Net

Name does not exist in namespace error in XAML with VB.Net

I'm new to WPF and trying to figure out how bindings work. I've created a
new namespace and added a class with a parameter-less class since the
class can not be a subclass or have parameters to be instantiated in the
xaml. The local reference I assume is correct since intellisense came up
with it and correctly found the Model2 class. However, I get an error
saying that Model2 does not exist in the m3 namespace. Did I miss
something?
MainWindow.xaml
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:simpleBindingExample.m3"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<local:Model2 x:Key="m2"/>
</Window.Resources>
<Grid>
</Grid>
</Window>
Model2.vb
Namespace m3
Public Class Model2
' auto-implemented properties
Public Property X As Double
Public Property Y As Double
Public Sub New(Optional x1 As Double = 0, Optional y1 As Double = 0)
X = x1
Y = y1
End Sub
End Class
End Namespace

No comments:

Post a Comment