Так что я убежден, что это, вероятно, простой ответ, и я просто не вижу его, но после 20 поисков в Google и 3 дней попыток выяснить это самостоятельно, я сдаюсь. Я использую xaml ниже. Мне нужно, чтобы два текстовых поля заполнили все оставшееся пространство и имели одинаковый размер. Я пробовал StackPanel, DockPanel, Grid (как показано ниже) и даже вкладывал каждый из них и вкладывал UniformGrid. Кажется, ничего не работает, я просто получаю 2 текстовых поля с любой высотой, указанной для MinHeight. Изменение параметра Grid.Row
с Авто на * приводит к центрированию текстовых полей и их перемещению по мере уменьшения и увеличения окна.
<TabItem Header="Notes" Name="notesTab">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="23"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Content="Select Contact:" Height="28" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" FontStyle="Italic" FontWeight="Bold"></Label>
<ComboBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Right" Width="150" ItemsSource="{Binding Source={StaticResource contactList}}" DataContext="{Binding Source={StaticResource contactList}}" Name="contactSelectionBox"></ComboBox>
<WrapPanel Grid.Row="1" Height="Auto" Grid.ColumnSpan="2" Margin="5">
<WrapPanel.Width>
<Binding ElementName="callNotes" Path="ActualWidth" />
</WrapPanel.Width>
<Label Content="TAD" Width="Auto" Name="tadShortcut" MouseLeftButtonDown="tadShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="VI" Width="Auto" Name="verifyInfoShortcut" MouseLeftButtonDown="verifyInfoShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Not there" Width="Auto" Name="uipShortcut" MouseLeftButtonDown="uipShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="WUSP" Width="Auto" Name="wuspShortcut" MouseLeftButtonDown="wuspShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="FNYD" Width="Auto" Name="fnydShortcut" MouseLeftButtonDown="fnydShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Not Employed" Width="Auto" Name="notEmployedShortcut" MouseLeftButtonDown="notEmployedShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Message" Width="Auto" Name="messageShortcut" MouseLeftButtonDown="messageShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Late Fees" Width="Auto" Name="lateFeesShortcut" MouseLeftButtonDown="lateFeesShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Payoff" Width="Auto" Name="payoffReqShortcut" MouseLeftButtonDown="payoffReqShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="No Commit" Width="Auto" Name="noCommit" MouseLeftButtonDown="noCommit_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="12/12" Width="Auto" Name="twelve12" MouseLeftButtonDown="twelve12_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="No ID" Width="Auto" Name="vmNoID" MouseLeftButtonDown="vmNoID_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Wrong #" Width="Auto" Name="wrongNumber" MouseLeftButtonDown="wrongNumber_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Day Off" Width="Auto" Name="dayOff" MouseLeftButtonDown="dayOff_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="FPD" Width="Auto" Name="firstPaymentDefault" MouseLeftButtonDown="firstPaymentDefault_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Repo Pmnt" Width="Auto" Name="repoPayment" MouseLeftButtonDown="repoPayment_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="CS Xfer" Width="Auto" Name="custServ" MouseLeftButtonDown="custServ_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Spanish" Width="Auto" Name="spanish" MouseLeftButtonDown="spanish_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
</WrapPanel>
<MyNamespace:WatermarkTextBox Grid.Row="2" Grid.ColumnSpan="2" Style="{StaticResource TextBox Style}" MinHeight="98" Margin="15,5,15,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Name="callTwoNotes" TextChanged="callTwoNotes_TextChanged" FontWeight="Bold" IsEnabled="False" ClipToBounds="False"></MyNamespace:WatermarkTextBox>
<Button Grid.Row="3" Grid.ColumnSpan="2" Height="23" Name="flipFlopButton" VerticalAlignment="Center" Width="75" Click="flipFlopButton_Click">
<Image Source="Images/FlipFlop.gif" />
</Button>
<MyNamespace:WatermarkTextBox Grid.Row="4" Grid.ColumnSpan="2" Style="{StaticResource TextBox Style}" MinHeight="98" Margin="15,5,15,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Name="callNotes" TextChanged="callNotes_TextChanged" FontWeight="Bold"></MyNamespace:WatermarkTextBox>
</Grid>
</TabItem>
xaml для стиля в текстовых полях ниже, только для полноты.
<Style x:Key="TextBox Style" TargetType="{x:Type MyNamespace:WatermarkTextBox}">
<Setter Property="CharacterCasing" Value="Upper" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="23" />
<Setter Property="Width" Value="Auto" />
<Setter Property="SelectAllOnGotFocus" Value="True" />
</Style>