Just sample of behavior:
namespace XAMLParserBug
{
public class MyCustomClass
{
public int ID { get; set; }
public string Name { get; set; }
}
}
then use it in XAML:
<UserControl x:Class="XAMLParserBug.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:XAMLParserBug"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<UserControl.Resources>
<local:MyCustomClass ID="1" Name="My Name With Spaces" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot">
and then get the error:
'My Name With Spaces' is not a valid value for Name
Is it a XAML parser bug or well-known behavior?
Added:
Anyway, WPF XAML parser correctly processed Name property in this case (VS 2008 SP1).