Note that there are some explanatory texts on larger screens.

plurals
  1. POReading an XML File create a UI
    primarykey
    data
    text
    <p>Below is a sample XML which I want to read and create a few GUIs based on these structures at runtime, (the basic idea is to read the fields from a XML file and create the screen for the user input).</p> <p>I have written some sample code which creats the screen at run time, however i am not sure how o do this when i wish to read the fields from the XML file.</p> <p>Any help is really appreciated.</p> <p>Below is the sample C# code to do this (I want to do this in WPF).</p> <pre><code>private void Init() { StackPanel spParent = new StackPanel(); StackPanel sp; for (int i = 0; i &lt; 5; i++) { sp = CreateLabelTextPair(i); spParent.Children.Add(sp); } spParent.Orientation = Orientation.Vertical; spParent.Margin = new Thickness(2); this.Content = spParent; this.Height = spParent.Height + 10; this.Width = spParent.Width + 10; } StackPanel CreateLabelTextPair(int i) { StackPanel sp = new StackPanel(); Label lbl = new Label(); lbl.Height = 25; lbl.Width = 100; lbl.Content = "Label" + (i+1); sp.Children.Add(lbl); sp.Margin = new Thickness(2); TextBox tb = new TextBox(); tb.Height = 25; tb.Width = 100; tb.Text = "TextBox" + (i+1); sp.Children.Add(tb); sp.Height = lbl.Height; sp.Width = lbl.Width+tb.Width+10; sp.Orientation = Orientation.Horizontal; return sp; } </code></pre> <p>Below is the sample XML (which i wish to read and create the GUI look like a data entry screen).</p> <pre><code> &lt;DataSet&gt; &lt;Data&gt; &lt;Field1&gt;Name&lt;/Field1&gt; &lt;Field2&gt;DataType&lt;/Field2&gt; &lt;Field3&gt;Length&lt;/Field3&gt; &lt;Field4&gt;DefaultValue&lt;/Field4&gt; &lt;Field5&gt;IsNull&lt;/Field5&gt; &lt;Field6&gt;Precesion&lt;/Field6&gt; &lt;/Data&gt; &lt;/DataSet&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload