Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically create rows and columns
    text
    copied!<p>Sorry if this is a noob questions. I just started learning WPF so hopefully you guys dont mind. But, is it possible to create two columns for each row dynamically through the xaml or would this have to be done in back end code (viewmodel, .cs)? Right now I have just a long list of items through binding with datasource. For example, datasource = "{binding path=House.Item}" ... Item is a collection which stores the label and value as it execute a stored procedure call. eg: label="Color", value="White".</p> <p>I currently have:</p> <blockquote> <p>Color &lt;-- label</p> <p>White &lt; -- value in a textblock</p> <p>Window &lt;-- label</p> <p>Vinyl &lt; -- value in a textblock ... etc</p> </blockquote> <p>I would like to have the result to be 2 column for each row (doesnt display correctly):</p> <blockquote> <p>Color | >>> Window</p> <p>White | >>> Vinly</p> <p>Door | >>> Basement</p> <p>Wood | >>> Finished</p> </blockquote> <p>The reason why I would want to achieve this is so I can eliminate the horizontal scrolling just in case the items gets really long. Any advice would be helpful. Thanks a lot in advanced.</p> <p>Update:</p> <pre><code>&lt;ListBox.Resources&gt; &lt;DataTemplate DataType="{x:Type Models:HouseDetail}" &gt; &lt;Views:HouseView&gt; &lt;/DataTemplate&gt; &lt;ListBox.Resources&gt; </code></pre> <p>This is pretty much how my data is generated which again is giving me a flow of like "top to bottom" whereas I would like it to show "left to right". eg: 1 2 3 &lt;-- (what I want) instead of</p> <p>1</p> <p>2</p> <p>3</p>
 

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