In my XAML File there is the following Line:
<TextBox Text="{TemplateBinding ValueOutput}"
TextWrapping="Wrap" BorderBrush="#FF000000" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalContentAlignment="Center" x:Name="textBox"
Background="{TemplateBinding Background}" Focusable="False" IsHitTestVisible="False"
FontSize="{TemplateBinding FontSize}" Width="{TemplateBinding Width}" />
I want to change the Width-Attribute so there’s allways subtracted one constant pixel from the defined Width.
It should be something like
Width="{TemplateBinding Width}-1"
I know XAML just for a few days and i cant find anything on the internet to solve this problem so far. Is it just a syntax-problem or is it impossible to do this?
Thank you for your answers!
Sven
You can’t just do this in XAML. You’ll need some code-behind for this. You’ll have to use Converter and ConvertParameter in your binding code in XAML. Here’s a little more about the topic:
http://msdn.microsoft.com/en-us/library/system.windows.data.binding.converter.aspx
I’m sure you’ll be able to find more if you search for “XAML databinding converter”