resourcedictionary

Linked Themes/Generic.xaml Files will not work in visual studio 2008

i have a project that i am doing and i need to share the code between silverlight and WPF Assembly problem is that even though the wpf assembly is the owner of that file and the silverlight assembly only has a link to the file, all of the build actions are page everything is correct. if i make the silverlight assembly the owner then silv...

WPF: Error using a custom control in the ItemTemplate of another custom control

I have a custom control library where I have several custom controls that I use in my main application. I have a simple custom control that lets the user select pen thickness values from a combobox. Now, I am creating a new custom control, based on a listbox, and I want to include the pen thickness combobox in the new custom control's It...

DataTemplates in resource dictionaries don't inherit from app.xaml styles??

I added custom named styles to the app.xaml. I created an external resource dictionary (which I attach in the merged dictionaries of the app.xaml) and when I try to use one of the above named styles in the rcource dictionary, it says that there is no such style. Also the default styles (i.e. unnamed styles that apply for the entire app...

Difference Between Value attribute and explicit DataTrigger.Value in ResourceDictionary?

Can anyone tell me why the following doesn't work, but the one after it does? Notice the Value= syntax versus the explicit usage on the latter. I don't understand the difference. <Style.Triggers> <DataTrigger Binding="{Binding ItemType}" Value="{x:Type log:FranchiseAiring}"> <Setter Property="Template" Value="{StaticResource...

access system:string resource dictionary xaml in C#

Hello! How do I access the contents in a resource dictionary using C#? for example, here is my code in XAML: <system:String x:Key="NewGroup">New Group Name</system:String> and i want to access it here in C# private void OnAddGroup(object sender, ExecutedRoutedEventArgs e) { BooksGroupInfo group = new BooksGroupI...

searching and listing WPF resource dictionaries in a folder

I'm making a WPF application that is going to have multiple skins branded in by our build system. Ideally we would like the application to list off the skins available as some builds will have one to many skins. At runtime is there a way to enumerate all the Resource Dictionaries in a specific folder? I want to avoid hard coding the ...

How do I load MergedResources at runtime? My code is not working as intended.

I have a desktop WPF application that loads it's resources from the web, this allows us to do different things like...add a christmas theme later on down the road around the holidays if we want. To load the Theme, I would just replace the Applications current resource dictionary with our own resource dictionary like so. Resourc...

How can I access my ResourceDictionary ???

I have a ResourceDictionary called CustomStyles.xaml within in my project. It is located in a subdirectory called RD, therefore its location is RD/CustomStyles.xaml. My question is the following: I have a class-only file called CustomGroupBox.vb, and in the New(), I would like to access resources from the ResourceDictionary. How can I ...

Packaging ResourceDictionary for Silverlight Class Library

I have a silverlight class library (not a top-level application) with several user controls that are shared by different silverlight applications. I have gone through and pulled out several styles and brushes for the controls and put them in a separate XAML file as a resource dictionary which I bring into each control as a merged resourc...

Replacing Merged Resource Dictionaries on Load of Silverlight Application

I have a set of styles and brushes defined in a ResourceDictionary that I am loading as a MergedDictionary in XAML of my top-level control: <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/MyAssembly;component/Styles.xaml"/> </ResourceDictionary.MergedDictionaries> I am trying to optionally replace some of the...

Adding DataTemplate (non-XAML) to resource dictionary in code?

I'm trying to figure out how to add a DataTemplate to the app's resource dictionary. I'm familiar with how to do so when the DataTemplate is in XAML (via a uri), but I'm kind fuzzy at how to do so when the DataTemplate is defined in code. What I have, which isn't working is- //Create DataTemplate DataTemplate template =...

XAML - MergedDictionaries throwing XmlParseException "item has already been added". Why?

hi all, I have the following, very easy to reproduce problem: I'm creating a xaml application which uses resources from another file. The way to go is to create a MergedDictionaries-tag to merge the local and global resources, like this: <Window> <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries...

Styling a UserControl in WPF from another assembly

Hi, I have a WPF user control defined in an application assembly. I'm trying to style the user control based on styles in another (skin or theme) assembly. I don't want the theme/skin assembly which contains the resourcedictionary with all the styles to reference the application assembly. Is there any way of doing this? E.g. WPFApp...

WPF - C#: This element is not currently associated with any context

I have a WPF UserControl, which I use in a WinForms Control within an ElementHostControl. Then I start a WPF Window, while the Windows Form is still open. If I then close the WPF Window, and try to add a Child Element to my WPF UserControl, it crashes at "InitializeComponent()" (of the Child Element) with the exception: "A first chan...

Binding to ancestors from within a ResourceDictionary

How can I bind to a UserControl's property from within its ResourceDictionary? I want an object I declare in my resources to have the same DataContext as the UserControl it is contained in: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xm...

WPF: Sharing resources across assemblies

I previously posted a question on sharing resources across assemblies using Themes/generic.xaml and the ComponentResourceKey markup extension. The solution works nicely, but it requres all of the shared resources to be located in the generic.xaml resource dictionary. Mine is getting rather large, so I thought I would use merged dictionar...

(WPF) How to set value of a sys:Double to SystemFonts.MessageFontSize from ResourceDictionary?

Scenario: I want to use 3 standard font size for my WPF application : BigFontSize, NormalFontSize, and SmallFontSize. These are double values and they are defined in resource dictionary as (where sys is appropriately defined): <sys:Double x:Key="BigFontSize">18</sys:Double> <sys:Double x:Key="NormalFontSize">14</sys:Double> <sys:Doub...

Trying to use a ResourceDictionary, but styles in it come up as not found

I have a Silverlight class library, called MyClassLibrary. In it, I have a user control, called MyControl. Within the control I define user resources: <UserControl.Resources> <Style x:Key="ComboBoxStyle" TargetType="ComboBox"> (lots of xaml) </Style> </UserControl.Resources> The control consumes the style like this: ...

How to reference WPF style keys defined in a separate assembly in another library

I have two libraries and a single application assembly project layout and I'm wondering how can I reference styles by their key in one of my libraries that's defined in the other. My solution layout: WpfControls.dll - Holds generic reusable controls such as a WPF based NumericUpDown control as well as other basic controls and some st...

WPF Merged ResourceDictionary inconsistencies

Hi everyone, I have a ResourceDictionary, which consists of a Brush object and a Style using this Brush object for several animated properties in its Template property (via StaticResource markup extension). The problem is; when I merge the dictionary with the global application ResourceDictionary (Application.Resources) the Brush does n...