How do I get the XAML comiler to use textual content property on custom classes?
- by Duncan
Given a simple C# class definition like:
[System.Windows.Markup.ContentProperty("PropertyOne")]
public class SimpleBase
{
public string PropertyOne { get; set; }
public string PropertyTwo { get; set; }
}
why is it not possible to ommit the sys:string tags around the word Test in the xaml below.
<custom:SimpleBase x:Class="TestType"
xmlns:custom="clr-namespace:ConsoleApplication1;assembly="
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<sys:String>Test</sys:String>
</custom:SimpleBase>
Somehow the compiler correctly coverts text to string for the type String, why doesn't it work for my custom type?
The context can be found on my blog: http://www.deconflations.com/?tag=xaml