locked
Set soruce in the binding in Expression Blend RRS feed

  • Question

  • Hello,

    I'd like to know how can be source specified in a Binding. That's, I want a bindink look like this:

    Text="{Binding Path=LocalizedResources.LocalizedString, Source={StaticResource LocalizedStrings}}"

    However, Blend generates a DataContext Property:

    DataContext="{Binding Source={StaticResource LocalizedStrings}}"

    Text="{Binding LocalizedResources.LocalizedString}"

    The problem is that I've already set a DataContext property in the root of the page for the "real data" (e.g. DataContext="{Binding Source={StaticResource MyViewModel}}"). What I want is to localize titles etc. So when I bind a text to a LocalizedResources' property, DataContext of the element is set to "LocalizedStrings", and this  overrides all bindigs of children elements I had already set to MyViewModel's properties.

    Friday, March 2, 2012 12:17 PM

All replies

  • Does your version of the binding work properly?
    Friday, March 2, 2012 1:54 PM
    Moderator
  • Does your version of the binding work properly?

    Yes.

    But I have to manually edit the XAMLs.

    Friday, March 2, 2012 2:13 PM