views:

23

answers:

0

I have a class (below is an example) that contains a list of objects. This class also contains other members. I deserialize this class upon loading my program and serialize it upon closing. I want to keep everything regarding the configuration of the UI in one XML file.

The issue is I want to give the user a way of editing the ButtonList list, and the most aesthetically appealing method is to bring up a new form using a DataGridView. I could easily hard-code the DataGridView to have a column for the 4 current fields of the CustomButton object, but this will require constant revision as the program evolves (there are a few new fields for the CustomButton object already).

The problem--how can I deserialize only the list object of this XML file and bind it directly to the DataGridView?

<?xml version="1.0" encoding="utf-8"?>
<LogConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  <LogFont>Lucida Console</LogFont>
  <LogSize>10</LogSize>
  <LogFore>Lime</LogFore>
  <LogBack>Black</LogBack>
  <SpliceFont>Lucida Console</SpliceFont>
  <SpliceSize>10</SpliceSize>
  <SpliceFore>Yellow</SpliceFore>
  <SpliceBack>Black</SpliceBack>
  <ButtonList>
    <CustomButton>
      <ButtonName>Session</ButtonName>
      <Expression>New Session</Expression>
      <SearchType>Line</SearchType>
      <OccurrenceNumber>0</OccurrenceNumber>
    </CustomButton>
    <CustomButton>
      <ButtonName>asdfsdf</ButtonName>
      <Expression>fsdaf</Expression>
      <SearchType>Block</SearchType>
      <OccurrenceNumber>0</OccurrenceNumber>
    </CustomButton>
  </ButtonList>
</LogConfig>