resourcedictionary

Proper usage of Merged Resource Dictionaries in Silverlight 3

As I read: http://msdn.microsoft.com/en-us/library/cc903952(VS.95).aspx, specifically the section labeled "Forward References With a ResourceDictionary": Static resource references from within any given resource dictionary must reference a resource that has already been defined lexically before the resource reference. Forward...

WPF - Implicitly style control within another control

Hi, Is it possible in WPF to implictly style a control that sits within another control? For example, style an image within a button, without styling all images? ...

Specify width/height as resource in WPF

Is there a way in WPF to specify a width/height as a resource, so that it can be reused in several styles for e.g. margin/padding? ...

WPF Updating styles at runtime

I would like to update the default Window style dynamically at runtime so I can change the FontSize and FontFamily dynamically at runtime. I found that Styles in your resource dictionary are sealed at runtime and cannot be changed, so I used the following method of updating the style: <Style TargetType="{x:Type Window}"> <Setter Pro...

switching wpf resource dictionaries at runtime

Hi all, I am trying to build a wpf application that allows the user to change the theme at runtime. What I have done so far is create a resourcedictionary with all the colors for the application defined in it and then I am binding to this dictionary in the xaml. Below is the code I have for switching the resource dictionary: if (Syst...

Image shows in Expression Blend but not during runtime

The image in question is located in a ControlTemplate inside of a ResourceDictionary similar to this (various details removed for clarity): <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/express...

Storyboards in ResourceDictionary

So I would like to move my Storyboards into a ResourceDictionary file and I am having trouble doing that. I have looked everywhere and it involves making the "Resource" sharable but how do I do that in silverlight when there is no x:Shared attribute. Here is the code <Storyboard x:Key="GreenButtonLight" > <ColorAnimationUsingK...

WPF resource merged to Application.Resources but not resolved at runtime

I have a brush that is part of a ResourceDictionary that is merged to Application.Resources. But for some reason it's not resolved at runtime when a style is being applied to one of the controls. However, if I call Application.Current.FindResource("BrushName") from the Immediate Window at the time when exception is thrown, the resource ...

Merging Resources Dictionaries

Hi, i'm trying merging wpf resource dictionaries on the code behind but for some reasion this isn't working. If i try merge the dictionaries on the document itself it's running for instance: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:...

WPF reference style in resource dictionary and use triggers

I have a style defined in a resource dictionary that applies to all ComboBox controls. Within the ComboBox control, I reference the style like so: Style="{DynamicResource MyComboBoxStyle}" This works ok. I want to be able to add some triggers to some of the ComboBox controls. What is a good way to use the style referenced as a dynamic...

What is the scope of StaticResource within a WPF ResourceDictionary?

I have a WPF ResourceDictionary with the following TextBlock: <TextBlock Visibility="{Binding Converter={StaticResource MyBoolProp ResourceKey=BoolToVis}}"> </TextBlock> The ResourceDictionary is included in App.xaml under MergedDictionaries: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionar...

Can you define a ResourceDictionary.MergedDictionary together with other (local) resources in <Windows.Resources> ?

I would like to refer to a MergedDictionary together with locally declared resources in my Windows.Resources. However, I'm getting this error: "All objects added to an IDictionary must have a Key attribute or some other type of key associated with them." Is it possible to mix local resources together with imported resources ...

Silverlight 4.0: DataTemplate Error

Im trying to get the specific template in my resource dictionary. This is my resource dictionary <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:view="clr-namespace:Test.Layout.View" xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:x="http...

WPF Theming: not applied to TextBox, why?

Hi there. I must say I am quite new at WPF. I am building my first real application and I am facing some issues, at the moment with themes. This is the reason of my post. In order to use a theme, such as ExpressionDark.xaml, I thought it was sufficient to include it at an application level. Therefore, in my App.xaml I added: <Applicat...

WPF Resource Dictionary XSLT

To use images in wpf you can define: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <BitmapImage x:Key="ImageFunTime" UriSource="../Resources/Images/ImageFunTime.png" /> ... Then in app somewhere you can: var img = (Im...

How to draw complex shape from code behind for custom control in resource dictionary

Hi I am new to wpf and am having a problem which may or may not be trivial. I have defined a custom control as follows in the resource dictionary: <ResourceDictionary x:Class="SyringeSlider.Themes.Generic" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml...

How to reuse layouts in WPF

I'm trying to create a application that will be tabbed where each tab will have a button area and a view area. Now each tab will essentially have the same layout just different things in the layout and I wanted to be able to reuse the same layout so that I won't have to change at many places ( it's just not good programming ). Can I acc...

How to have a dynamic theme color in WPF

In WPF I have a few resource dictionaries and in them styles for my panels and controls in my app. I'm reusing the same colors again and again. I actually have 5 colors and they give my app a good color-scheme. However if I wan't to change the theme I have to go into the RD's and change each and every color there. I would like to somew...

WPF ResourceDictionaries

I have a wpf tab control which is highly customized through styles. I have referenced those styles in a resourcedictionary "TabControlResources". How do I reference "TabControlResources" in another resourcedictionary?. I have a resourcedictionary called "MainViewResources" and I would like to reference the tab style from my "TabContro...

How to get at ResourceDictionary style when it is loaded from external xap and assemblies are MEF-fed?

I've got the following setup: The main application loads a XAP with an IPlugin implementation. The Plugin contains a 'DisplayPanel' that contains a referenced Control with other controls. The DisplayPanel here is simply a container control to show referenced Control. This referenced Control, from an assembly, uses a Style from a Resourc...