problem with resource dictionary

if I write like this in App.xaml
 <Application.Resources>
        <Style x:Key="CustomWindow" TargetType="{x:Type Window}">
        </Style>

        <ResourceDictionary x:Key="lng" Source="lang/eng_lang.xaml">
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="lang/eng_lang.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </Application.Resources>
   then when I use  <Label Content="{DynamicResource SelUn}" the SelUn cannot be resolved.

If I remove
    <Style x:Key="CustomWindow" TargetType="{x:Type Window}">
        </Style>
and it will be only :
 <Application.Resources>
        <ResourceDictionary Source="lang/eng_lang.xaml">
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="lang/eng_lang.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

<Label Content="{DynamicResource SelUn}"  shows the correct string but I need use others styles in app.xml
How can I point into my code for <Label Content= the x:Key for the resource dictionary? I think this is the problem.
LVL 1
mastiSoftAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
Your style needs to go inside the Resource Dictionary:

<Application.Resources>
        <ResourceDictionary x:Key="lng" Source="lang/eng_lang.xaml">
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="lang/eng_lang.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="CustomWindow" TargetType="{x:Type Window}" />
        </ResourceDictionary>
</Application.Resources>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mastiSoftAuthor Commented:
how I resolve this ?
2.PNG
Chris StanyonWebDevCommented:
Ahh. Ok. You can't add children to a resource dictionary if the Source is set. You are setting the source for the outer resource dictionary as well as the merged one. You only need to set it on the merged one:

<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="lang/eng_lang.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="CustomWindow" TargetType="{x:Type Window}" />
        </ResourceDictionary>
</Application.Resources>

Open in new window

mastiSoftAuthor Commented:
Hi. I understand the point, thank you .
mastiSoftAuthor Commented:
Thank you very much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WPF

From novice to tech pro — start learning today.