What's the best way to handle layout issues with multi-language support in WPF/XAML?
- by Tim
I'm creating a standalone WPF app with multi-language support. I've found some great resources (mostly on SO) on how to store and access the strings as needed. This part is pretty straightforward and doable, but I'm fuzzy on how to take care of screen layout issues.
I'm using some custom images to skin up my app for buttons, etc. For instance, here's a button with some text within:
<Button
Canvas.Left="33"
Canvas.Top="484"
Style="{StaticResource SmallButtonBase}">
<TextBlock
FontSize="20"
FontWeight="Bold"
TextAlignment="Center" FontFamily="Helvetica">
Enter
</TextBlock>
</Button>
Now here is the same button with text from another language:
<Button
Canvas.Left="33"
Canvas.Top="484"
Style="{StaticResource SmallButtonBase}">
<TextBlock
FontSize="20"
FontWeight="Bold"
TextAlignment="Center" FontFamily="Helvetica">
Enterenschtein
</TextBlock>
</Button>
So my question is: What is a good method to prevent this "overflow" situation. I'd like to have XAML take care of any font resizing or indenting that is needed automatically so that I don't have to tweak the UI for each language I'm supporting.
Any insight is appreciated!