i get an Exception during (UIElement)XamlReader.Load(...) which says
'Cannot create unknown type 'TextBox'.' Line number '1' and line position '2'.
on the following xaml:
<TextBox Name="inputMyFirstString" BorderThickness="0" HorizontalAlignment="Stretch" Text="test"></TextBox>
What did i wrong?
I know this is an old question but I think the "right" answer is still missing. You can avoid changing your XAML by adding the required namespaces in code:
ParserContext context = new ParserContext();
context.XmlnsDictionary.Add("","http://schemas.microsoft.com/winfx/2006/xaml/presentation");
context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml");
//etc.
object content = XamlReader.Load(stream, context);
I think, this is due to missing namespace. Try
<TextBox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With