views:

25

answers:

2

This is a nice-to-have for our designer. She has a layout where a form title, on the top right of the form banner, is two words in English. There are several forms so the words are a little different each time. So the effect is something like:

|    firstword|
|         form|

There is a fancy swoopy thing underneath this and some other fields to the left. Of course with several different forms, the words are different lengths, so sometimes the words are on one line, because they fit in the width:

|   short form|

She wants the words to always be on two lines, basically classic 'flush right'. AFAIK this isn't really possible, especially with localization. If you get fancy with some codebehind that replaces the spaces with linebreaks, you'll have words that disappear or don't use all the space in localization.

So my question is if there is a way in WPF (maybe in some of those typography functions) to get a flush right look easily--if the word 'form' is always on the bottom and flush right, with whatever other words above flush right.

A: 

Sounds like the data that make up the 2 lines is separate ahead of time. As such it would be best to keep it separate rather than have it combined only to have to parse out later. Which I think is what led you to where you are now.

If the data is kept separate then you don't need to worry about trailing spaces (or it is easily trimmed). Simply stick a line feed in there when putting it to the display.

DaveWilliamson
The data is one localized string. If it was English and two separate strings, it'd be easy. Having to account for all the languages is why the kind of restricted layout that's desired won't really work.
dex3703
You're going to have to put a marker in your data someplace which will tell the layout engine how to break things up. That means more work (once per language) for your localizers, but frankly that's part of the work of localization; localizers have to be aware of the visualization and UI design constraints.
Rob Perkins
Thanks. That's way outside my responsibility but at least that's a good answer if it comes up again. :)
dex3703
A: 

Something like this?

   <StackPanel Name="StackPanel1">
        <WrapPanel Name="WrapPanel1" HorizontalAlignment="Right">
            <TextBlock Name="TextBlock2"  HorizontalAlignment="Right" TextWrapping="Wrap">
                <TextBlock.Text>
                    Lorum Ipsum Dolum Lorum Ipsum Dolum Lorum Ipsum Dolum Lorum Ipsum Dolum Lorum Ipsum Dolum Lorum Ipsum Dolum 
                </TextBlock.Text>
            </TextBlock>
        </WrapPanel>
             <TextBlock Height="23" Name="TextBlock1" Text="Form" HorizontalAlignment="Right" />
   </StackPanel>
Rob Perkins