This project is read-only.

Dynamic View of XML

Apr 27, 2010 at 6:55 PM

I have an XML file that I am using to store application settings. Is it possible to use the WPF Property Grid control to show a dynamic view of the data in this file?

An example config file would be:

 

<?xml version="1.0" standalone="yes"?>
<Adapter_Settings>
  <LoggingLevel>1</LoggingLevel>
  <PARALLEL-2200>TRUE</PARALLEL-2200>
  <LIMIT-4001>2</LIMIT-4001>
  <LIMIT200>2</LIMIT200>
  <LIMIT-2200>10</LIMIT-2200>
  <TransferManagerConfig>
    <FTPServerMapping>Server1</FTPServerMapping>
    <DestinationFolder>ServerOne</DestinationFolder>
    <DestPBName>ServerI</DestPBName>
  </TransferManagerConfig>
  <TransferManagerConfig>
    <FTPServerMapping>Server2</FTPServerMapping>
    <DestinationFolder>ServerTwo</DestinationFolder>
    <DestPBName>ServerII</DestPBName>
  </TransferManagerConfig>
</Adapter_Settings>

 

I realize that the best I can hope for from this is a textbox editor. Thats fine as a starting point.

Thanks

Coordinator
Apr 27, 2010 at 10:02 PM

You can use the PropertyGrid, to show the Properties of a CLR Object!

If you create a CLR Object from your XML Data, it should be possible!

Apr 28, 2010 at 10:14 PM

I want to keep this all as late bound as possible. So how about something like loading the XML into a dataset, or using the XElement object?

Coordinator
May 6, 2010 at 6:39 PM

I don't think this is the task of a Property Grid!

Jun 15, 2010 at 9:47 PM

You may try using Linq to XSD. This is a simple way to manage xml files in a object oriented manner. You should be able to bind objects to WPG and make it live. I'll investigate this further because  I need the same functionality.

Mar 31, 2011 at 5:46 PM

Has any of you managed to solve this?

 

I want to bind the propertyGrid to XML. I do have a schema, and the schema will be describing what properties are "editable" in the propertyGrid.

Can I create data templates maybe as an alternative?

 

What I mean is binding to the xml, and using DataTemplate generated from schema?