Questions tagged [xaml-resources]

15 questions
6
votes
1 answer

Why is the ResourceDictionary in Application.Resources requiring a x:Key

I have a ResourceDictionary in a separate file called MainSkin.xaml :
AymenDaoudi
  • 7,811
  • 9
  • 52
  • 84
3
votes
2 answers

How to define the same resource with another key?

If I have some resource defined in resources section of a control or in external resource dictionary, how can I define the same resource with another key? I mean how can I define resource entry that is just reference to another already existing…
serges_newj
  • 795
  • 1
  • 13
  • 23
2
votes
2 answers

How to use the viewmodel, model, command classes with Data Binding in the Window.Resources tags?

If WPF MVVM is supposed to have no code behind, why does when you use the ICommand, do you need the DataContext property instantiated in the Window.xaml.cs code behind? I've watched and followed side by side YouTube WPF MVVM, data binding, ICommand,…
FlazzG
  • 21
  • 3
2
votes
2 answers

How To Use a XAML Resource As An Icon In Mahapps.Metro Title Bar?

I have a small application, using the Mahapps Metro Framework. I would like to change the icon in the title bar like connect/disconnect icon. How can i access the content or bind it dynamically? This is my XAML:
Daniel
  • 511
  • 10
  • 25
1
vote
1 answer

How to get the root element inside an applied DataTemplate when it does not have a resource key?

I wish to get the root element inside an applied DataTemplate. I tried this but it does not work for me, because for the ContentPresenter returned by MyItemsControl.ItemContainerGenerator.ContainerFromItem(vm) where vm is a ViewModel,…
silviubogan
  • 3,343
  • 3
  • 31
  • 57
1
vote
1 answer

Duplication in XAML styles

I have xaml styles that have different target types but are otherwise identical. Is there a way I could cut out the duplication and define the style only once?