c# - XamlReader official code snippet throwing exception for me -
i'm building windows 8 app, , want parse xaml web service set in richtextblock. i'm trying utilize xamlreader utilize this, this code microsoft's documentation throwing exception in environment.
string xaml = "<ellipse name=\"ellipseadded\" width=\"300.5\" height=\"200\" fill=\"red\" \"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"/>"; object ellipse = windows.ui.xaml.markup.xamlreader.load(xaml);
when executing sec line, exception:
an unhandled exception of type 'windows.ui.xaml.markup.xamlparseexception' occurred in mscorlib.dll winrt information: illegal qualified name character [line: 1 position: 68] additional information: unspecified error
my version of vs microsoft visual c# 2012 (microsoft visual studio premium 2012 version 11.0.51106.01, microsoft .net framework version 4.5.50709). documentation says windows 8 should back upwards load method. ideas?
it looks there's typo in xaml - they're missing xmlns=
before namespace uri:
string xaml = "<ellipse" + " name=\"ellipseadded\" width=\"300.5\" height=\"200\" fill=\"red\"" + " xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"/>";
(line wrapped readability.)
c# xaml windows-8 xamlreader
No comments:
Post a Comment