views:

17

answers:

1

Hi everybody

I want to realize context help for application View based on flow documents. For example, user presses Ctrl+F1 and context help about current View appears over this View. The help content must must be localized.

In window markup can looks like this:

<Window x:Class="UdkppReports.Window2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window2" Height="300" Width="300">
<Grid>
    <ContentControl x:Name="View"/>
    <ContentControl x:Name="Help" Visibility="Collapsed">
        <ContentControl.Style>
            <Style>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding CurrentView.HelpContent}" Value="{x:Null}">
                        <Setter Property="Grid.Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ContentControl.Style>
    </ContentControl>
</Grid>

View.HelpContent property is the instance of a UserControl with embedded FlowDocumentScrollViewer. In non-localized application for each View class I will create one HelpContent class. What about for localized application?

One and only idea is present now - for each View class must be created as many HelpContent classes as many cultures application supports. For example, for SomeView class I have:

  • SomeViewHelp class (default)
  • SomeViewHelp_fr class
  • SomeViewHelp_it class
  • and so on

and in custom SomeView.LoadHelp command (or custom Loadhelp event or elsewhere) I need to dynamically determine name of the help class such as

string lang = Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;
string helpClassShortName = "SomeView_" + lang;

and further get the full class name, try to dynamically create instance of the help class and assign View.HelpContent property to this instance. This should work, but may be a standard approach to flow document localization exists?

A: 

Did you try LocBaml tool for localization? Every xaml element supports x:Uid attribute, so you can use this solution. Also there is an article about localization in MS Exam 70-502 Training Kit.

vorrtex
I don't try to use LocBAML because my own idea described in first message is seems to be quite appropriate the task.
JSP