I worked on creating markup extensions and started getting very strange VS behaviors. I extracted and identified the problem in a separate solution. The problem is that VS cannot create a CLR object in XAML.
There he is:
View:
<Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfApplication4="clr-namespace:WpfApplication4"> <Window.Resources> <wpfApplication4:Dog x:Key="doggy" /> </Window.Resources> <Grid /> </Window>
Code behind:
using System.Windows; namespace WpfApplication4 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } } }
Dog Class:
namespace WpfApplication4 { public class Dog { } }
App.Xaml (no code in App.Xaml.cs):
<Application x:Class="WpfApplication4.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> </Application.Resources> </Application>

The exception I get is:
Error 1 The name "Dog" does not exist in the namespace "clr-namespace:WpfApplication4". \\hopr1\folders$\vxk\Documents\Visual Studio 2012\Projects\WpfApplication4\MainWindow.xaml 6 9 WpfApplication4
I can run the solution, but the designer fails with the error "Invalid Markup" Any ideas?
Edit
I am launching VS 2012 Update 2 The same solution works in VS 2012 Update 1
c # wpf xaml
Vitalij Apr 25 '13 at 13:54 2013-04-25 13:54
source share