I'm currently having a problem with Visual Studio 2012.
I have a WPF project with a window, and I would like to put a personalized class in this window.
So I created a new C# class, CarteCanvas.cs :
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WPF
{
public class CarteCanvas : Canvas
{
public CarteCanvas()
{
}
}
}
And in MainWindow.xaml, I call it like that :
<Window x:Class="WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPF"
Title="Boris World" Height="600" Width="800">
<Grid Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="400*" />
<RowDefinition Height="170*" />
</Grid.RowDefinitions>
<ScrollViewer HorizontalAlignment="Stretch" Grid.Row="0">
<local:CarteCanvas />
</ScrollViewer>
<Rectangle Fill="#FFF4F4F5" HorizontalAlignment="Stretch" Grid.Row="1" Stroke="Black" />
</Grid>
</Window>
But this isn't working. I have this error : The name "CarteCanvas" does not exist in the namespace "clr-namespace:WPF". And when I start writing local: , the autocompletion is showing CarteCanvas, as if it was well recognized...
I don't know if I am doing this properly, or if there are some things to do, but if you could help me, I would be very thankful !