Ask Your Question
2

In the WPF application, where can I find the shared resource that has been compiled?

asked 2021-06-06 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-07-10 00:00:00 +0000

scrum gravatar image

Shared resources in a WPF application are typically defined in a ResourceDictionary and can be located in various places depending on how they were added to the application.

Here are some common locations:

  1. If the resources were defined in a standalone XAML file, they would likely be located in the application's directory, in a subfolder called "Resources", or in a folder named after the theme that the resources are for.

  2. If the resources were defined in a resource dictionary within the application, they would likely be located in the App.xaml file, which is in the root of the WPF project.

  3. If the resources were defined in a resource dictionary within a control or window, they would be located in that XAML file.

To access a shared resource defined in a ResourceDictionary in code, you can use the FindResource method on the resource's key. For example:

var myBrush = (Brush)FindResource("MyBrushKey");
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-06-06 11:00:00 +0000

Seen: 12 times

Last updated: Jul 10 '21