473,618 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Path to xaml resource file

I have a user control located in the following path:

projectFolder/PropertyControl s/myControl.xaml

and in myControl.xaml I have a reference to a resource dictionary like this:

<UserControl.Re sources>
<ResourceDictio nary>
<ResourceDictio nary.MergedDict ionaries>
<ResourceDictio nary
Source="Resourc es/ControlResource Dictionary.xaml "/>
</ResourceDiction ary.MergedDicti onaries>
</ResourceDiction ary>
</UserControl.Res ources>

However this doesn't compile because ControlResource Dictionary.xaml is
located under the main project folder like this:

projectFolder/Resources/ControlResource Dictionary.xaml

What's the correct way to show this path in myControl.xaml?

Thanks.

--
mo*******@newsg roup.nospam
Aug 25 '08 #1
4 17927
Hello,

Welcome to Microsoft Newsgroup Support Service! My name is Marco Zhou. It's
my pleasure to work with you on this thread.
If I understand you correctly, you have a UserControl which resides in
"PropertyContro ls" subfolder under the current project, and inside this
UserControl, you need to merge a resource dictionary file which resides in
another subfolder say "Resources" . If this is the case, there are two
options you could try:
First option:
If the current project is a custom control library, you could use the
following the pack URI syntax to refer to the resource dictionary file:
Assemblyname;co mponent/Resources/ControlResource Dictionary.xaml

"Assemblyna me" is the name of the assembly which is built from the current
project. For instance, if your project name is "MyCustomContro lLib", then
you could name the assembly as "MyCustomContro lLib", so the pack URI will
be:
MyCustomControl Lib;component/Resources/ControlResource Dictionary.xaml

Second option:
If the current project is a WPF executable project, you could use the
following pack URI instead:
pack://application:,,,/Resources/ControlResource Dictionary.xaml

For more information on pack URI scheme, you could refer to the following
link:
http://msdn.microsoft.com/en-us/library/aa970069.aspx

If you continue having any further questions on this issue, free feel to
ask here, we are glad to answer them.

--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.mi crosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 25 '08 #2
moondaddy wrote:
I have a user control located in the following path:

projectFolder/PropertyControl s/myControl.xaml

and in myControl.xaml I have a reference to a resource dictionary like this:

<UserControl.Re sources>
<ResourceDictio nary>
<ResourceDictio nary.MergedDict ionaries>
<ResourceDictio nary
Source="Resourc es/ControlResource Dictionary.xaml "/>
</ResourceDiction ary.MergedDicti onaries>
</ResourceDiction ary>
</UserControl.Res ources>

However this doesn't compile because ControlResource Dictionary.xaml is
located under the main project folder like this:

projectFolder/Resources/ControlResource Dictionary.xaml

What's the correct way to show this path in myControl.xaml?

<ResourceDictio nary Source="../Resources/ControlResource Dictionary.xaml "/>

Alun Harford
Aug 25 '08 #3
Thanks Alun! This worked.
"Alun Harford" <de*****@alunha rford.co.ukwrot e in message
news:ut******** ******@TK2MSFTN GP06.phx.gbl...
moondaddy wrote:
>I have a user control located in the following path:

projectFolde r/PropertyControl s/myControl.xaml

and in myControl.xaml I have a reference to a resource dictionary like
this:

<UserControl.R esources>
<ResourceDictio nary>
<ResourceDictio nary.MergedDict ionaries>
<ResourceDictio nary
Source="Resour ces/ControlResource Dictionary.xaml "/>
</ResourceDiction ary.MergedDicti onaries>
</ResourceDiction ary>
</UserControl.Res ources>

However this doesn't compile because ControlResource Dictionary.xaml is
located under the main project folder like this:

projectFolde r/Resources/ControlResource Dictionary.xaml

What's the correct way to show this path in myControl.xaml?


<ResourceDictio nary Source="../Resources/ControlResource Dictionary.xaml "/>

Alun Harford

Aug 25 '08 #4
Thanks Marco,

To make your suggestion work, I had to use the following syntax:

<ResourceDictio nary
Source="pack://application:,,,/UIControls;comp onent/Resources/ControlResource Dictionary.xaml "/>

where UIControls is the assembly name. Alun's suggestion also worked with
the following syntax:

<ResourceDictio nary Source="../Resources/ControlResource Dictionary.xaml "/>

"Marco Zhou [MSFT]" <v-*****@online.mi crosoft.comwrot e in message
news:kw******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hello,

Welcome to Microsoft Newsgroup Support Service! My name is Marco Zhou.
It's
my pleasure to work with you on this thread.
If I understand you correctly, you have a UserControl which resides in
"PropertyContro ls" subfolder under the current project, and inside this
UserControl, you need to merge a resource dictionary file which resides in
another subfolder say "Resources" . If this is the case, there are two
options you could try:
First option:
If the current project is a custom control library, you could use the
following the pack URI syntax to refer to the resource dictionary file:
Assemblyname;co mponent/Resources/ControlResource Dictionary.xaml

"Assemblyna me" is the name of the assembly which is built from the current
project. For instance, if your project name is "MyCustomContro lLib", then
you could name the assembly as "MyCustomContro lLib", so the pack URI will
be:
MyCustomControl Lib;component/Resources/ControlResource Dictionary.xaml

Second option:
If the current project is a WPF executable project, you could use the
following pack URI instead:
pack://application:,,,/Resources/ControlResource Dictionary.xaml

For more information on pack URI scheme, you could refer to the following
link:
http://msdn.microsoft.com/en-us/library/aa970069.aspx

If you continue having any further questions on this issue, free feel to
ask here, we are glad to answer them.

--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.mi crosoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 25 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
9389
by: Thomas A. Li | last post by:
I have a Java program which reads a text file when it is running. How to deploy it into the jar file I will deploy? The CLassLoader.GetSystemResource(String name) only search the class path and it doesn't search inside the jar file. Any suggestion? Putting the resource file separated from jar file is not my option. Thanks in advance.
0
870
by: David | last post by:
Hello, I have built a service component to serve as a data access layer for an ASP web application. The component is built using C#. To store passwords, connection strings, specify the path to the component directory, etc. I am using the resource file--config.resx--which is compiled into a config.resources file. The file is read just fine. My
3
3329
by: al | last post by:
Hi, I use a resource file (.resx) to store user's settings such as language and other strings. The problem i'm facing is that when the user changes one of the strings in the resource file, those changes are shown by VB.NET untill after the user reloads the app. Is there any work-around for this behavior so changes can appear without relaoding the app??
3
15728
by: DBC User | last post by:
Hi, I have bunch of image files I want to add it to the resource file at the design time and I would like to read them from the resource file. Could soneone point me to a link or give me some advice on how to do this? All the search I found is to add them through programs but I would like to do it at design time. I did create a folder in the solution and put the files in the folder and in the program I used...
2
2313
by: Patrick F | last post by:
Hi, i have a resourcefile with my project that contains a jepg image. Now i want to retrive that image to a Image m_Image in my program. Whats the best way to do this?
8
12065
by: John Dunn | last post by:
Since currently we aren't allowed to have compiled XAML files embedded in C++ apps I'm using Markup::XamlReader::Load to dynamically load XAML files. This works perfectly fine with external files but I'd like to be able to load a file specified in a .resx resource. I've added my .xaml file to the .resx and can load it in using ResourceManager::GetObject(). The object returned is a System::Array^ which contains System::Byte objects. The...
0
2396
by: raylopez99 | last post by:
I have a minor problem locating an image file to load as a Bitmap. A resource file "NudeSusan.jpeg" (which I think is actually a bmp file, originally taken from a jpeg of model Susan Spears) is loaded onto the "Resources" tree of the Visual Studio Solutions Explorer, and correctly works. However, another file, "MyImageFile.png" (which is also a bmp file, sorry for the confusion, but originally was a png file), does not work. How can...
1
4611
by: Moot | last post by:
The scenario is that I am processing a large text file and moving each line to one of a number of other files based on some criteria. I have an array of file pointers with writable files. I have a limitation where each of these subfiles can only contain a maximum of 8000 lines. Once I reach that mark, I would like to close the current file pointer and open a new one with an integer increment appended to the filename. My problem is...
0
2640
by: mahendra dubey | last post by:
Hi There I m new to WPF. I have two projects 1)Project1(Windows project 2)Project 2(WPF project). I have a strings.resx resource file in project1.I have created a new usercontrol in project2.There is a textblock control in this UserControl.Now How can I bind text of this TextBlock to key of strings.resx file.I wanna do it in XAML not in code. I have added a reference of project1 in project2. Please Help....
0
8212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8595
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8304
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7126
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5552
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4065
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.