Note that there are some explanatory texts on larger screens.

plurals
  1. POWpf dynamic design with Grid and data binding
    primarykey
    data
    text
    <p>I am creating dynamic UI using from code.I am adding grid to the Page using for loop,in multiple rows and 4 columns,so it takes time to load UI on Page.I want to load each child Grid lazily, I don't know how to do it, please help. here is XAML file</p> <pre><code>&lt;ScrollViewer Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CanContentScroll="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0 0 0 0"&gt; &lt;Grid x:Name="mainGrid" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="10" Width="Auto"&gt; &lt;/Grid&gt; &lt;/ScrollViewer&gt; </code></pre> <p>and this is pseudo code from .cs file</p> <pre><code>for (int column = 0; column &lt; dsMacDtls.Tables[0].Rows.Count; column++) { grid = new Grid(); grid.Width = 108; grid.Height = 108; if (column % 4 == 0) { mainGrid.RowDefinitions.Add(new RowDefinition()); } else { mainGrid.RowDefinitions.Add(new RowDefinition()); } box = new CheckBox(); TextBlock tb = new TextBlock(); tb.Text = "abcd"; box.Content = tb; grid.Children.Add(box); ImageBrush myBrush = new ImageBrush(); image = new Image(); image.Source = new BitmapImage(new Uri("abcd.png")); grid.Background = myBrush; Grid.SetColumn(grid, 0); Grid.SetRow(grid, i); Border br = new Border(); br.BorderThickness = new Thickness(1); br.BorderBrush = new SolidColorBrush(Colors.Gray); Grid.SetColumn(br, 0); Grid.SetRow(br, rowNumberofMachine); br.Width = 108; br.Height = 108; grid.Children.Add(br); mainGrid.Children.Add(grid); } </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.
 

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