wpf-resource

Aliasing Resources (WPF)

I am trying to alias a resource in XAML, as follows: <UserControl.Resources> <StaticResourceExtension x:Key="newName" ResourceKey="oldName"/> </UserControl.Resources> oldName simply refers to a resource of type Image, defined in App.xaml. As far as I understand, this is the correct way to do this, and should work fine. However,...

WPF - Can't get storyboard to affect another local resource

Hi, I've set up a Transformation and a Storyboard as local resources, but when I trigger the storyboard from a button I get the following error: {"'WorldTranslation' name cannot be found in the name scope of 'System.Windows.Controls.Button'."} Can someone point me in the right direction please? <Window.Resources> <Transform3DGro...

WPF - KeyFrame animation not working

Hi, I've got a KeyFrame Animation storyboard and a separate rotation transformation in my Window.Resources. The rotation transformation works as I can alter the angle and see the content rotate. I know the storyboard is being called, because it took me a few goes to get the PropertyPath right after I clicked on the button. However no...

Get notified of DataContext changed in a WPF Resource

Hi all: I'm having an annoying problem with WPF binding. Basically, I declare a FrameworkElement in my UserControl's resources, but that item doesn't seem to get notified when the DataContext of the parent UserControl changes. Basically, in my UserControl I have a Popup in the ItemTemplate for an ItemsControl. In that Popup, I needed...

Can't access resource from Generic.xaml within the Custom Control constructor.

I'm not sure why this is doing this, but I can't access the resource from within my constructor. XTabItem.cs using System; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace MyStuff { public class XTabItem : TabItem { public static readonly Dependency...

WPF Add Events in Resource file

Hi I am designing an user control in which i am using datagrid.. now i wanna to raise hyperlink click event to the parent window(where i am using user control) how to do this... Questions i have.. 1)I declared my data grid inside resource file.. now when i add evend handler for the hyperlink its asking for the x:class attribute in re...

WPF: Can you make this resource declaration less verbose?

This works, but I don't think I'm doing it right. <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/Aam.Gui;component/AamBlue.xaml" /> <ResourceDictionary> <gui:RepKeyValueConverter x:Key="RepKeyValue...

What's the recommended way to expose standard colors in WPF

I would normally just create a static class like StandardFooColors and create a static field for each standard color. However, with WPF I could also put these in a resource dictionary. Just wondering if there is a recommended way to do this or if it is 6 of 1 or half dozen of the other? ...

wpf resource binding to another element's property

I'm new to WPF so pardon me if i'm asking something stupid. I have an class named Person in my application. Can i do something like <local:Person x:Key="p" BirthYear="{Binding Path=Value, ElementName=year}" /> where 'year' is a control? ...