resourcedictionary

What could be used as a double sided Resource Dictionary?

I am using a ResourceDictionary, but I would like to be able to look up the value or the key with the other item. Each is always unique, so that is not a problem. Is there a type that has this double sided lookup feature? ...

WPF Resource Dictionary in a separate assembly

I have resource dictionary files (MenuTemplate.xaml, ButtonTemplate.xaml, etc) that I want to use in multiple separate applications. I could add them to the applications' assemblies, but it's better if I compile these resources in one single assembly and have my applications reference it, right? After the resource assembly is built, how...

WPF: Style based on another one in a separate assembly

Assembly A - ResourceDictionary contains StyleA style. Assembly B - ResourceDictionary.MergedDictionaries to merge resources from Assembly A into B. I would like to create a style in Assembly B "based on" StyleA. Is it possible? I am trying to create this style: <Style x:Key="StyleB" BasedOn="{StaticResource StyleA}"> <Setter Pro...

Load WPF styles (static resources) from an external assembly

I have a few WPF applications and I want all my styles to be in a shared assembly instead of declaring them in each application separately. I am looking for a way so I don't have to change all my Style="{StaticResource BlahBlah}" in the existing applications; I just want to add the reference to this style assembly, and delete it from th...

Load a ResourceDictionary from an assembly

I've got an assembly somewhere on the file system, e.g. "C:\temp\test.dll". In that assembly there's a ResourceDictionary, e.g. "abc.xaml". How can i get that ResourceDictionary? Maybe there is a way using Reflections? I didn't find a solution so far. Thanks in advance! Edit: Just wanted to add that I want to access the Resources in t...

Copy a ResourceDictionary to a Dictionary in C#

I have a ResourceDictionary only containing string keys and string values. Now I want to have a Dictionary< string, string > with the same content. How would you do that? Whats the fastest solution in C#? Edit: Fastest in terms of perfomance ;) ...

Enable data binding in shared WPF resources inside a ResourceDictionary

I'm using the M-V-VM pattern in WPF and I have a background brush I'm going to be using rather often and I'd like to move it out in to a shared ResourceDictionary. The only problem is the brush uses a color which it gets via Databinding to its hosted context. Is there anyway I can move the brush out in to a ResourceDictionary and still...

Accessing ResourceDictionary from WPF UserControl

I'm trying to access a resource dictionary in a UserControl code-behind via C# and I'm having little success. Merged Dictionary: <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Resources/BiometricDictionary.xaml" /> </Resou...

Is it possible to share a ResourceDictionary file between multiple projects?

If I have a ResourceDictionary in one project, is it possible to create another project that uses resources defined in the first project? Note that both projects are WPF Applications, not ControlLibraries. Thanks!! ...

ResourceDictionary in WPF Control Library

Hello - We are creating an office ribbon that opens up a WPF window that is stored in another WPF Control library project. That WPF window has some themes attached to it that is stored in a ResourceDictionary that is compiled in a separate project. However when we load up the WPF window, all the themes from the ResourceDictionary are ...

C#/WPF: Add Window.Style, even if a ResourceDictionary already exists

Hello, I'm trying to add two Datatriggers to my WPF Window. Normally, this would work via adding `<Style TargetType="{x:Type TextBlock}"></Style>` to the Window.Resources. In this case, I already have `<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Pr...

How to define XAML shapes in a ResourceDictionary and use them

What is the general approach for creating reusable XAML shapes in a ResourceDictionary? If I define a Path or other shape in the ResourceDictionary, how do I go about using it? I would like to have a clickable diagram in my application, made up of several shapes. I imagine that I would use Buttons in the diagram, but I would like them t...

Composite WPF (Prism) module resource data templates

Given that I have a shell application and a couple of separate module projects using Microsoft CompoisteWPF (Prism v2)... On receiving a command, a module creates a new ViewModel and adds it to a region through the region manager. var viewModel = _container.Resolve<IMyViewModel>(); _regionManager.Regions[RegionNames.ShellMainRegion].Ad...

Extending/overriding a style in a resource dictionary

I have a BaseSkin and multiple UserSkins in a separate dll from my WPF application. Depending on who is using the application, the base skin and one of the user skins will be merged into a resource dictionary and loaded for the application to use. What I'm aiming for is the ability to specify a style in a BaseSkin file, and then on a s...

How to style a XAML window with a ResourceDictionary that exist in a DLL?

Hi I am trying to create a reusable XAML Window in a DLL. I have placed in the Themes folder a new ResourceDictionary (I even merged it in the Generic.xaml), but when I try to use its styles in the window, I get an error message that the style doesn't exist: <Window Style="{StaticResource ModalWindowStyle}" > <!-- I have also the f...

Trouble referencing a Resource Dictionary that contains a Merged Dictionary

I have a library, CommonLibraryWpfThemes, with several Resource Dictionary XAML files in it. My Themes/Generic.xml file contains a ResourceDictionary.MergedDictionaries declaration that merges all the other files together. Generic.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x...

How to override a global style (that doesn't have an x:Key), or alternatively apply a named style to all type-targeted controls?

Hello all! I declared a style that I want to apply to ALL the buttons in the project, the style resides in the ResourceDictionary: <Style TargetType="StackPanel"> <Setter Property="Orientation" Value="Horizontal" /> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/>...

How can I add a Path, that has been defined in the XAML ResourceDictionary, multiple times to a WPF form at runtime?

I have a defined path in XAML: <UserControl.Resources> <ResourceDictionary> <Path x:Key="N44" Width="20" Height="80" Stretch="Fill" Fill="#FF000000" Data="M 20,25.2941L 20,29.4118L 15.9091,29.4118L 15.9091,40L 12.2727,40L 12.2727,29.4118L 2.54313e-006,29.4118L 2.54313e-006,25.6985L 13.4872,7.62939e-006L 15.9091,7.62939e-006L...

Resources for both WPF and Silverlight in the same assembly

I have resources in separate assemblies to be used by multiple WPF apps and this is working fine. Now I am creating a Silverlight 3 app and am trying to use the same assembly to get the same resources. I get an error at the time of adding a reference, saying only Silverlight assemblies can be referenced. What's the best way for me to do...

Silverlight 3: Merged Resource Dictionary - from non-embedded file

I have a SL3 application that my client wants to be able to skin for their customers. I do not want a separate xap for each customer. I want to be able to define a resource dictionary for each customer. Is it possible for me to have the same xap for all the customers and point to an external xaml file (resource dictionary) that I will ...