Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Unable to fill WPF Textbox control with full Height and Width into Stack Panel on Window Resize

$
0
0

Hi,

I am new in WPF Application development and stucked in a very small problem could anyone of you please help me out in this.

I want to fill my WPF textbox control into StackPanel on window resize. Below are the code which i am using for creating my User control.

The problem is height of the textbox gets increased automatically.

<Grid Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}">
        <TabControl HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="220">
            <TabItem Header="Hotel" Width="108" Height="35">
                <Grid Background="White"/>
            </TabItem>
            <TabItem Header="Restauraunt" Width="108" Height="35">
                <Grid Background="White"/>
            </TabItem>
        </TabControl>
        <StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Stretch">
            <StackPanel Margin="220,0,10,10" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Orientation="Horizontal" >
                <Button Height="40" Width="100" HorizontalAlignment="Left" Margin="10,0,0,0">Find</Button>
                <Button Height="40" Width="100" HorizontalAlignment="Right" Margin="10,0,0,0">Book</Button>
            </StackPanel>
        </StackPanel>
        <StackPanel Margin="0,40,0,60" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
            <StackPanel Margin="230,0,10,10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Horizontal">
                <TextBox TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" AcceptsReturn="True"
                    Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}, Path=ActualWidth}"
                    Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}}, Path=ActualWidth}"/>
            </StackPanel>
        </StackPanel>
    </Grid>


Viewing all articles
Browse latest Browse all 18858

Trending Articles