Click here to Skip to main content
16,010,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
please I want to define the structure of a WPF control in xml.
And I want to do as follows in order to use XamlReader class:
<pre lang="HTML">
<MenuItem Tipo="C"  ContenidoGrid=" <Grid> cualquier contenido </Grid>" Estado="E"/>
</pre>
But in trying to process it, tells me to define it as:

<MenuItem Tipo="C"  ContenidoGrid=" &lt;Grid&gt; cualquier contenido &lt;/Grid&gt;" Estado="E"/>


And I do not want to do it this way because it would not be as readable for me, at the time of editing.
Is there any way to tell xml try everything in ContenidoGrid = ".." , treat it as a simple text and not be posting in special characters (<,>).

Or maybe there is a different kind of structure to xml maybe JSON
Posted

1 solution

You can bind the xaml datagrid directly to xml by using the XmlDataProvider.
E.g.
<datagrid.itemssource>
     <binding source="{StaticResource items}" />
 </datagrid.itemssource>
 <datagrid.columns>
     <datagridtextcolumn binding="{Binding XPath=@value}" />
 </datagrid.columns>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900