Questions tagged [dependency-properties]

A property in WPF and Silverlight that can be set through methods such as, styling, data binding, animation, and inheritance.

Dependency property is a property backed by a static DependencyProperty instance.

The purpose of dependency properties is to provide a way to compute the value of a property based on the value of other inputs and to provide notification when computed value changes. The priority of inputs which contribute to computation is listed in Dependency Property value precedence overview.

Dependency properties usually have CLR "wrappers": the actual get and set implementations for the property.

Dependency property declaration (static field + wrapper) is a boilerplate code, which follows a certain pattern and can be generated by IDE (check Visual Studio shortcuts here).

General information: Dependency Property Overview

2294 questions
0
votes
2 answers

WPF using DependencyProperties to bind Slider Value and MaxValue

Firstly I am assuming DependencyProperty is what to use but I could be wrong - Maybe a INotifyPropertyChanged is more suitable? I have a few UI controls that are all associated to audio playback. I would like to bind the Volume and Track Seek…
Dominic
  • 62,658
  • 20
  • 139
  • 163
0
votes
1 answer

Template Part Not Available As Visual Child. When Custom Control Visibility is Collpased By Default

I am using sdl/Multiselect-ComboBox inside my UserControl which is collapsed by default. On press of a button the UserControl Visibility is set to visible and hence every thing should be loaded in Visual Tree. If visibility is set to Visible the…
Safi Mustafa
  • 515
  • 7
  • 22
0
votes
2 answers

Dependency Property in a user control library is always null

So i got this Control: CharacterMapControl.xaml:
Flo
  • 325
  • 2
  • 6
  • 18
0
votes
0 answers

WPF custom panel child initialization

I am currently working on a custom Panel implementation (based on Canvas) with a specific behavior. As I need to make several actions depending on child properties. In order to implement the control, I also developed specific child control (based…
0
votes
2 answers

UWP DependencyProperty Binding and DataTemplate Binding

I have a PlaylistControl (it is a UserControl) with a variable ShowAlbumText declared in this way: public bool ShowAlbumText { get => (bool)GetValue(ShowAlbumTextProperty); set => SetValue(ShowAlbumTextProperty, value); …
Seaky Lone
  • 992
  • 1
  • 10
  • 29
0
votes
1 answer

How to apply a HeaderTemplateProperty to a HeaderProperty inside in a CustomControl?

In the MyCustomControl, I created the Heder and HeaderTemplate dependency properties. public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register( "Header", …
Yury Yatskov
  • 175
  • 2
  • 7
0
votes
1 answer

SelectionChanged Called before OnApplyTemplate in wpf Custom Control

I am working on a custom control called select 2 inspired by WPF Auto Complete. The problem is that my OnSelectionChanged (binded with a Dependecy Property called SelectedItem) is called before OnApplyTemplate (all controls are initialized for the…
Safi Mustafa
  • 515
  • 7
  • 22
0
votes
2 answers

UWP User Control ConverterParameter Binding is null

I have a UserControl which has a property Theme. The Theme is just an Enum of ElementTheme. public sealed partial class PlaylistControl : UserControl, MediaControlListener { public ElementTheme Theme { get; set; } public static readonly…
Seaky Lone
  • 992
  • 1
  • 10
  • 29
0
votes
1 answer

Passing incorrect values into MultiValueConverter by MultiBinding

I've been trying to implement a dynamic ToolTip (WPF) for RadioButton (the ToolTip switches, when IsEnabled of the RadioButton changes). I wanted to achieve this with a MultiValueConverter, which would be sort of a general Converter, that accepts 3…
Hit
  • 1
  • 1
  • 1
0
votes
1 answer

customcontrol: setting text wirks with string but not with binding; default button instead same binding works

I use a custom control that has a dependencyproperty Title that binds to a label within. I can set the Title property in xaml with a string but not with a {Binding title}. If I use a
0
votes
1 answer

C# passing dependency properties in an attribute

I am creating a self composing UserControl in WPF. I have an attribute I adorn the properties of my entity with that instructs my SelfComposingUserControl what to do. If I want a property to be edited by a specific UI Control I pass this in my…
Lance
  • 251
  • 5
  • 13
0
votes
1 answer

Binding 'SelectedItems' dependency property to ViewModel property does not work

I have a multiselect Combobox usercontrol and a dependency property 'SelectedItems'. I m trying to use the usercontrol and bind the 'SelectedItems' to another property called 'SelectedResultItems' in my ViewModel. But I dont get any values to…
0
votes
0 answers

WPF weakly subscribe to the IsEnabledChanged event

Is it possible to weakly subscribe to the UIElement.IsEnabledChanged event? Neither the WeakEventManager WeakEventManager .AddHandler(uie,…
wondra
  • 3,271
  • 3
  • 29
  • 48
0
votes
1 answer

Dependency Property ListBox's ItemsSource in UserControl

I develop new desktop app in C# WPF MVVM and I have a problem with data-binding. I create my own UserControl
AMZO
  • 1
  • 3
0
votes
1 answer

WPF: How can I reload the Custom Property's Default Value with it's Design-Time-Value from the parent XAML?

I am writing a User Control named "GridAndChart" that can be filled with values at Design-Time just like this:
Verena
  • 19
  • 6