resourcedictionary

Why are absolute uri's required for merged dictionaries in Generic.xaml?

Consider a File | New Project of a WPF Application that contains: A new custom control named CustomControl1 Two new resource dictionaries named Dictionary1 and Dictionary2 Take the generated style out of Generic.xaml and move it to Dictionary2. Then merge Dictionary2 into Dictionary1 and Dictionary1 into Generic like this: <!--Gener...

Why is XamlReader.Load unable to recognize my attached property in Silverlight 4?

I'm trying to figure out how to programmatically apply a theme at runtime in our Silverlight 4 application. I figured this should be as simple as loading a resource dictionary from XAML and merging it with the application's merged dictionaries. Here's my code so far: var themeUri = new Uri( "OurApp;component/Themes/Classic/Theme.x...

Accessing external static resources placed in different assembly and XAP

My prism based silveright application is divided into multiple xaps to reduce initial download size and support multi tenant application. However, I cannot access the resource dictionaries defined in external assembly (i.e. the resource .xaml file is part of an assembly that complies/ is copied into a different xap) Any suggestions ? b...

Runtime theme switching with explicit styles in Silverlight 4

It's been requested that we add dynamic theme switching to our application, and I'm having problems figuring out how to do this. Here's the current situation: our application has a merged resource dictionary with explicit (not implicit) styles. The views in our application refer to these styles through the StaticResource markup exten...

Adding a static ResourceDictionary to UserControls before the XAML is parsed

Hello community, I have one WPF control that I want to use in my WinForms application (using an ElementHost) in several places (=> multiple instances of this control). Furthermore I want all instances of my UserControl to share one single Instance of a ResourceDictionary. In WPF applications I would achieve that by merging my Resource...

How to create two HierarchicalDataTemplates which are mutually-referential in Silverlight?

Given that: DataTemplates cannot be assigned by TargetType StaticResource references can only reference previously How does one template the following situation in a TreeView? class Resource { public string Name {get;} public IEnumerable<Property> Properties {get;} } class Property { public string Name {get;} public IEn...

Silverlight 4: change themes/styles for whole app without using Toolkit

We are embarking on our first Silverlight project, coming from WPF. It's a relatively simple web portal and we would like to avoid references to the Silverlight Toolkit, given our experience with the WPF toolkit. I'm not much of a coder and have a couple questions related to themes: Implicit styles make this easier. It seems clear you...

Silverlight: App.Current.Resources is empty

What I have doen has been based on this article: http://msdn.microsoft.com/en-us/library/aa348547.aspx I am trying to get a string from a merged dictionary that is loaded in app.xaml. I am trying to do this from a class that is not a code behind file. I know that the resource file can load in principle because page elements are being st...

How to access DataTemplate in ResouceDictionary of UserControl

I have a resource dictionary as follows defined in my UserControl: <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../ParameterEditorResourceDictionary.xaml"></ResourceDictionary> <ResourceDictionary> <DataTemplate x:Key...

Source property on ResourceDictionary gets assigned late under .NET 4 vs. .NET 3.5

I have an application that loads a series of resource dictionaries programmatically at startup. I have derived AdvancedResourceDictionary from ResourceDictionary and I set its Source property to a XAML file containing an AdvancedResourceDictionary object, like so: var ard = new AdvancedResourceDictionary(); ard.Source = new Uri("/Sandb...

Resource Dictionaries in a Silverlight Assembly?

I've just begun dabbling in putting together a set of controls as assemblies and I'm working on default styling. What I currently have is a UserControl in a project (thanks Reed!) and I'm able to bring that into another project via reference. I plan to add more controls over time to build something of an SDK. I currently have some hooks...

WPF Checkbox style making focus border behave strangly

Hi All, I am using WPF with a style sheet. In my style I have been trying to customized the look of the dotted focus border for a checkbox. I need the focus border to only draw around the square an not the entire control. I set my style width to 15 and the dotted border is correct, but does not surround the square, its off to the side....

How can I access a string table that is in a XAML file from code?

I have a XAMl string table that is working a treat when i need to refer to it from my controls in XAML. However I could also do with being able to access it for use in other sections of code - such as validation messages in my model. As you cannot add a resource file to a silverlight I beed to use this. someone must know what i need to...

Reference to another Brush from one Brush in xaml

Is it possible to directly reference to a Brush value from another Brush in my resource dictionary, without using a Color definition (or to be exact, copy one brush resource into another)? For example, I have a Brush definition: <SolidColorBrush x:Key="PanelBackgroundBrush" Color="White"/> And I have a couple of other brushes I'd lik...

In WPF, how can I cross-reference resources between ResourceDictionaries?

Hi. I work on a WPF project with many UserControls and I'm trying to put some sanity in my WPF resources. A base file contains generic stuff needed by all views, such as colors: <!-- Resources.xaml --> <Color x:Key="FlashOrange">#F59500</Color> Then, a resource file specific to a view needs to reference FlashOrange: <!-- ContactV...

Creating WPF ResourceDictionary from code doesn't seem to work when setting ResourceDictionary.Source

I have a project containing a xaml ResourceDictionary that I wish to use outside of a FrameworkElement. The resource dictionary will contain a DataTemplate for a class local to the project to avoid polluting the app.xaml (as the project is a prism module, and will not always be present depending on config). So, I have a test.xaml file w...

Are there any designers for WPF resource dictionaries?

I've discovered to my great annoyance, that once I move a color gradient or some other complex style to a resource dictionary it is out of Expression Blend's Visual Studio WPF Designer Thingy's jurisdiction and must be edited in XAML. I have no issues with working in XAML except that it is more time intensive than a designer. So my que...