views:

599

answers:

2

I'm successfully getting a TextBox to resize with a parent Border height but I need the TextBox to actually be 50 pixels smaller in height than the parent Border.

Any ideas how to achieve this?

The code I'm using is

<Border VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
     <TextBox x:Name="txtActivityNotes" HorizontalAlignment="Stretch" Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Border}}, Path=ActualHeight}" AcceptsReturn="True" VerticalContentAlignment="Top" TextWrapping="WrapWithOverflow" VerticalScrollBarVisibility="Auto" />
</Border>
+1  A: 

how about using a converter on the binding to minus 50 off the height

heres an example of using a converter

Aran Mulholland
Hi Aran, I had considered using a converter but it seemed a bit overkill just to adjust a value by 50! I'm using converters elsewhere for visibility etc but I was hoping for a simpler solution if one exists...
Mitch
It definitely would be overkill. The margin should work.
PeterAllenWebb
+4  A: 

Can't you just set a bottom margin of 50?

<TextBox Margin="0,0,0,50" />
itowlson