我現在正在玩弄WPF,現在我想知道典型的數據入口窗口(20多個文本框和東西)的佈局是什麼。WPF DataEntry窗口的最佳實踐
使用這樣的(基本樣本)網格對象ATM我真的
<Grid Margin="2,2,2,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions >
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Vorname:</Label>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=Surname, UpdateSourceTrigger=PropertyChanged}" ></TextBox>
<Label Grid.Row="1" Grid.Column="0">Nachname:</Label>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=ChristianName, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label Grid.Row="2" Grid.Column="0">Strasse (Wohnsitz):</Label>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=Street1, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label Grid.Row="3" Grid.Column="0">Ort (Wohnsitz):</Label>
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=Town1, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label Grid.Row="4" Grid.Column="0">Postleitzahl (Wohnsitz):</Label>
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Path=PostalCode1, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label Grid.Row="5" Grid.Column="0">Bundesland (Wohnsitz):</Label>
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Path=State1, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label Grid.Row="6" Grid.Column="0">Land (Wohnsitz):</Label>
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Path=Country1, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Label Grid.Row="7" Grid.Column="0">Zusatz (Wohnsitz):</Label>
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding Path=AdditionalAdrInfo1, UpdateSourceTrigger=PropertyChanged}"></TextBox>
</Grid>
基本上這滿足我所有的佈局的需要,但如果我想改變一些東西,比如第3行中添加一個新的文本框?
目前我必須改變每一個Grid.Row屬性大於3,但不能成爲預期的WPF方式!?
其他人如何佈局複雜的數據入口窗口?
TIA
哇,那然後我希望:) 我會嘗試了這一點更多。 – 2008-11-25 12:49:39