0

I have following problem:

arrange items in WPF My TextBox should fill the entire space, but the property "VerticalAlignment="Stretch"" does not do this for me.

Here is my code:

<TextBox
x:Name="txt_in_ct_length_aisle"
Text="{Binding CtLengthAisle, UpdateSourceTrigger=PropertyChanged, 
      ValidatesOnDataErrors=True,NotifyOnValidationError=True}"
      Validation.Error="MainViewHasErrors"
      TextWrapping="Wrap" VerticalAlignment="Stretch" 
      KeyboardNavigation.TabIndex="0"/>
<Label x:Uid="LabelShowHint" Content="?" HorizontalAlignment="Right"/>

How should I set the properties right? To sum up, I want my TextBox to fill the space until the "?" on the right side.

Can anyone of you please help?

Thank you!

Dev Knight
  • 95
  • 1
  • 9

1 Answers1

0

You could try using a grid that has both controls, and control it using the Columns property.

    <Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <TextBox Grid.Column="0" 
             x:Name="txt_in_ct_length_aisle"
             Text="{Binding CtLengthAisle, UpdateSourceTrigger=PropertyChanged, 
             ValidatesOnDataErrors=True,NotifyOnValidationError=True}"
             Validation.Error="MainViewHasErrors"
             TextWrapping="Wrap" VerticalAlignment="Stretch" 
             HorizontalAlignment="Stretch"
             KeyboardNavigation.TabIndex="0"/>
    <Label Grid.Column="1"
           x:Uid="LabelShowHint" Content="?" />
</Grid>
Lupu Silviu
  • 1,145
  • 11
  • 23