resourcedictionary

WPF binding to nested objects in a ResourceDictionary

I have an object tree which is included in a ResourceDictionary in my application. The root node of this object tree has an x:Key associated with it. I want to bind a control to a property of one of the nested items in this tree. How can I get access to a child element of a keyed ResourceDictionary to allow me to do this? ...

WPF: Changing MediaElement source with ResourceDictionary

Hey, I want to use background music in my WPF Application. Like you can see here: http://stackoverflow.com/questions/3148965/how-to-do-background-music-for-my-wpf-application So I use a MediaElement. Now I want to change the source of it while running the Application. I'm already doing something similar with some background pictures....

WPF, WVVM, Databinding, and ResourceDictionaries

I've got a View (MainView) which contains a kind of main content area (MainContent). The View is backed by a corresponding ViewModel (MainViewModel). The main content changes, of course, based on the current state of the application and is represented in the ViewModel as a property (CurrentPrimaryViewModel). The content of MainContent...

Print Button inside DataTemplate? How to write code

Hi, I have a ContentControl element whose ContentTemplate is determined at run time from the Resource Dictionary. In the datatemplate I have a visual (Convas) and what I want is to also have a button in datatemplate which when clicked should print the visual element(canvas). As I said that the DateTemplate is inside the Resource Diction...

WPF ImageSource binding with Custom converter

Hi, I have a simple template for a combobox structured in this way: <ComboBox DockPanel.Dock="Left" MinWidth="100" MaxHeight="24" ItemsSource="{Binding Actions}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> ...

WPF executable won't run outside of Visual Studio (resource dictionary issue)

I have a WPF app that works beautifully if I "debug" (F5) in Visual Studio (Debug and Release mode both work), but if I try to double-click the .exe in the bin\Release folder, Windows kills the application immediately. The problem appears to be that the executable can't find "PresentationFramework.Aero", which I added to my App's resour...

StaticResource not found

I have the situation where a SolidColorBrush (defined in App.xaml) cannot be resolved during runtime, when i use the Brush in a Style as StaticResource. During designtime (using Visual Studio 2010) the brush is found, cause when i change the color of the brush the UIElement with the styles are updated with the new color. During runtime...

WPF ResourceDictionary Item has already been added using ComponentResourceKey

Hello, I have the following ResourceDictionary that gets merged into my Themes/Generic.xaml file <DataTemplate DataType="{x:Type model:RequirementResourceRelation}" x:Key="{x:Static local:Resources.RequirementResourceRelationListTemplateKey}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> ...

xClassNotDerivedFromElement error when adding Code Behind to Resource Dictionary in silverlight

I need to add code behind class to Resource Dictionary as described in this question. (I know that this is not a good practise but it should work based on the comments for linked question) .I'm referencing the code with x:Class attribute: XAML (separate Resource Dictionary file): <ResourceDictionary xmlns="http://schemas.microsoft....

Multiple Resource Dictionaries

Hey all, quick question about Silverlight Resource Dictionaries. So in resource dictionary number 1, I have a data template. That data template contains a hyperlink button. My hyperlink button style is defined in resource dictionary number 2. Could someone explain how I have to set up my dictionary references and merges and all that st...

Adding a Merged Dictionary to a Merged Dictionary

I can't seem to be able to add a merged dictionary to a collection of merged dictionaries within XAML. Theme.xaml <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Mine;component/Themes/Palette.Blue.xaml"/> <ResourceDictionary Source="/Mine;component/Themes/Template.xaml"/> </ResourceDictionary.MergedDiction...

WPF Dynamic Image Loading into ResourceDictionary programmatically

Morning folks, I've been trying to cut out some of my app's processing when I stumbled upon a suggestion on SO to load all images into a resource dictionary via BitmapImages, then referencing them rather than loading an image each time. My problem is that I need to do this all programmatically, so: <BitmapImage x:Key="MyImageSource" Ur...

Translating an application using resources in WPF

Hi, I saw in Silverlight 4.0 Business application that is it possible to have all the strings in one resource file that you could , potentially, change depending of the user so that each user has its own experience (ie langauge for example) I'de like to be able to do this in WPF also, so I though about moving that stuff from Silverlig...

accessing a resource dictionary in code wpf

The same line of code in the same assembly works for one test fixture but not another. Here is the line of code: var dic = new ResourceDictionary { Source = new Uri("pack://application:,,,/MyApp.Wpf;component/ImageResources.xaml") }; The error I get in the other test fixture is System.UriFormatException : Invalid URI: Invalid port spe...

XamlParseException occurred: Failed to create a 'System.Windows.Style' from the text 'PhoneMasterGridColumnHeader'.

I have four datagrids on a Silverlight 4 page. I'm trying to set different column header styles for each grid. I found this XAML which works when I embed it in each DataGrid inside <sdk:DataGrid.ColumnHeaderStyle> tags: <Style TargetType="primitives:DataGridColumnHeader" > <Setter Property="Template"> <Setter.Value> ...

Using SharedResourceDictionary in Silverlight

Christian Moser provides on his page a SharedResourceDictionary for WPF so that resource are only initialized once. I´ve tried to use this ResourceDictionary in my Silverlight 4 application, but i´m getting COMExceptions in Visual Studio or a message that the element is already a child of an other element. Has anyone successfully used ...

Strange Visual Studio Behaviour when setting Application Resource Dictionary

I'm trying to set the current WPF Application ResourceDictionary programatically. (I have a WindForms project, so no "App.xaml" to do that for me). Note: If anyone knows how to bind the equivalent of an Application.Resources to a ElementHost and all of its child controls hierarchy, this is the ultimate objective here. I added to my cod...

Splitting WPF ResourceDictionary

I have a WPF application made up of around seven user controls, each with a variety of different controls on each (textbox, combobox, radio button etc). Across the entire app I have applied a set of control styles take from the WPF Themes on CodePlex, however I have noticed a bit of a slowdown on the app since applying these styles. The...

Using xaml resources, but keeping unique content per reference

I have several ListBoxes and have set up the group style to make the groups expanders. I want all of the ListBoxes to use the same style information to make them all expanders, but i want to be able to change the content of the header to be custom for each use of the style. Is there any way i can take the out of the but still edit the...

Using system types in XAML as resources

I have encountered a situation where it would be very useful to specify a floating point value directly in XAML and use it as a resource for several of my UI pieces. After searching around I found a good amount of information on how to include the proper assembly (mscorlib) in your XAML so you can do just that. Unfortunately, I am gett...