Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6237995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:07:58+00:00 2026-05-24T11:07:58+00:00

I have a class named Animations and a resource dictionary named animationResources.xaml on the

  • 0

I have a class named Animations and a resource dictionary named animationResources.xaml on the same directory:

enter image description here

the way I am able to find a resource in that dictionary is by creating a resource dictionary with code providing the path of animationResources.xaml:

 ResourceDictionary dict = new ResourceDictionary();
 Uri uri = new Uri("/FilesPro2.1;component/Classes/Storyboards/animationResources.xaml", UriKind.Relative);
 dict.Source = uri;
 Application.Current.Resources.MergedDictionaries.Add(dict);

I am planing to export this project so the actual project name will be different and the path of the resource dictionary will also change. The only thing that I know is that the class and the resource dictionary will be located on the same directory in this case it is the directory Storyboards (look at the first image) So in order to build the Uri I guess I need to somehow get the path of the class and also get the name of the project. If I get those two strings I will probably be able to build the uri. How can I get the name of the project programaticaly (FilesPro2.1) and the path of Animations.cs (“C:\Users……..\FilesPro2.1\classes\storyboards\animations.cs”) also the names of the classes will be the same and also the name of the resource dictionary will be the same.


EDIT

I will try to explain my self a little better sorry. Ok so perhaps disregard the title question. I am building several projects and all of them have similar animations. as a result I want to create the storyboards with code. when I do that it is hard to set the easing functions with c# therefore what I have done is to create the easing functions with xaml where it is easier and create a basic animation with c# which it is also essay. when creating this animations on a separate class I am able to find the resource from the resource dictionary if I merge the dictionaries. But in order for me to merge the dictionaries I need to know the path. since I am planing to export this class and resource dictionary to several projects it will be nice if I don’t have to know the path or I don’t have to merge the dictionary in the app.xaml file for every project. My goal was to import the animationResources.xaml and Animation.cs to every project and then expect the class in (Antimation.cs) to find a resource from animationResources.xaml. I don’t know if that is possible the only things that I know is that when exporting animationResources.xaml and Antimation.cs they will have the same names and they will be located in the same directory. that’s why I thought that if it was possible to find the path of Antimation.cs I where going to be able to build the string of the path in order to merge the dictionary regarled off the name of the project etc..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:07:58+00:00Added an answer on May 24, 2026 at 11:07 am

    I too am relatively new to WPF. You said in your question “the way I am able to find a resource…” Are you also aware that you can find a resource just by using XAML? In you App.xaml file you can add an Application Resources as shown below:

     <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="StoryBoards\anmationResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    
    </Application.Resources>
    

    Then you can just use those resources with {StaticResource resourceName}. I would have added this as a comment to your question but I’ve never figured out how to format code in a comment and it’s very hard to read otherwise.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Class named Constants that contains all the constant variable in my
I have a class named toto which I send to a function that does
I have a class named CommonCode that is used for stocking all methods I
i have class named Group i tried to test configuration: var cfg = new
I have a class named baseClass. From this class I inherit a class names
I have a class named Person and in this class is the property PersonName
I have a class named project with the following data members. class Project {
I have a class named SuperclassA , and an class named ClassA . ClassA
I have a class named as order in package com.abc I have another class
Say I have a class named testThing: .testThing { background-color:#000000; float:left; height:50px; width:50px; }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.