Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Best Practice for DataEntry Window
    text
    copied!<p>i`m currently playing around with WPF and now i wonder what would be the layout for a typical dataentry window (20+ textboxes and stuff).</p> <p>atm i`m using a grid object like this (basic sample)</p> <pre><code> &lt;Grid Margin="2,2,2,2"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="*"&gt;&lt;/ColumnDefinition&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions &gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="Auto"&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;Label Grid.Row="0" Grid.Column="0"&gt;Vorname:&lt;/Label&gt; &lt;TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=Surname, UpdateSourceTrigger=PropertyChanged}" &gt;&lt;/TextBox&gt; &lt;Label Grid.Row="1" Grid.Column="0"&gt;Nachname:&lt;/Label&gt; &lt;TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=ChristianName, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="2" Grid.Column="0"&gt;Strasse (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=Street1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="3" Grid.Column="0"&gt;Ort (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=Town1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="4" Grid.Column="0"&gt;Postleitzahl (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=PostalCode1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="5" Grid.Column="0"&gt;Bundesland (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Path=State1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="6" Grid.Column="0"&gt;Land (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Path=Country1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;Label Grid.Row="7" Grid.Column="0"&gt;Zusatz (Wohnsitz):&lt;/Label&gt; &lt;TextBox Grid.Row="7" Grid.Column="1" Text="{Binding Path=AdditionalAdrInfo1, UpdateSourceTrigger=PropertyChanged}"&gt;&lt;/TextBox&gt; &lt;/Grid&gt; </code></pre> <p>basically this satisfies all my layout needs, but what if i wish to change something, like adding a new textbox in row 3?</p> <p>currently i have to change every single Grid.Row property greater then 3, but that cant be the intended WPF way!? </p> <p>how do others layout complex dataentry windows?</p> <p>tia</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