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
1 answer

WPF Dependency Property question ... need advice on what to do in this particular scenario:

I am attempting to create a sukodu (like crossword) player in WPF, and I realize that I have a whole bunch of controls that will need to know the sudoku grid to function. Because of this, I think the Sudoku Grid object would be a good candidate to…
Echiban
  • 849
  • 2
  • 11
  • 21
0
votes
0 answers

How to fix dependencyproperty for custom style

I'm working on a personal library to define styles. I have created some DependecyProperty to manage style size. Here is a part of the dependencies I have created : public class CheckboxExtensions : CheckBox { public static readonly…
Thibaud
  • 377
  • 1
  • 2
  • 15
0
votes
1 answer

Dynamically Injecting a Map

I have the following field called someMap in which I need to inject a map at runtime depending upon the inputs I have received. I have tried using the @Resource annotaion but it is tightly coupled to the beanId specified in the xml…
0
votes
1 answer

Trigger setter doesn't set new value to DependencyProperty after it changed

I really tried to find the solution but I failed. So I have ResourceDictionary in separate xaml file and Control class in another cs file. Here is xaml code:
0
votes
1 answer

Set binding with unknown objects

I'm trying to set a binding passing properties as parameters but i can't find a way on how to do it. This works: Binding bind = new Binding(); //Some code var tb = Control as TextBlock; tb.SetBinding(TextBlock.TextProperty, bind ); What i would…
0
votes
2 answers

Force dependency property to refresh

I want to force the binding of my Listbox to refresh its content. My listbox is bounded to a dependency property: I want to refresh the listbox content…
Sean
  • 15
  • 2
0
votes
0 answers

Short way to set UserControl as DependencyProperty

A way to shorten the record of the code below. I'd like to write this in…
A.Klim
  • 29
  • 3
0
votes
0 answers

Problem with binding a property in UserControl to a property of one its Dependency Properties

I have bound the Text property of a TextBlock in my UserControl to one of its dependency properties (DPs), and the initial binding works properly and the text is displayed. However, when the FrameRate property is updated later on, the change is not…
Vahid
  • 5,144
  • 13
  • 70
  • 146
0
votes
1 answer

WPF Sharing Dependency Properties?

I have the following situation: FooControl: I need for this control to be able to place content in a specific area, so I used a Canvas control for it.
michael
  • 14,844
  • 28
  • 89
  • 177
0
votes
1 answer

WPF Custom binding Collection to non dependency property

I've created my own custom binding class and added a property to it: public BindingGroupCollection BindingGroups { get { return validationResultGroup; } set { validationResultGroup = value; } } public class BindingGroupCollection :…
Sys
  • 443
  • 1
  • 8
  • 28
0
votes
2 answers

WPF UserControl with Image Property

I have a UserControl Library containing a user control to make a custom title bar for windows. I have given this title bar two dependency properties - Title and Icon, which I would like to be able to set when I use the control through a DLL. I have…
High Plains Grifter
  • 1,357
  • 1
  • 12
  • 36
0
votes
1 answer

Format string is ignored after TextBox gets bound to a property

In a dynamically built UserControl I have set the format string for a TextBox this way: TextBox newTextBox = new TextBox(); TempViewModel viewModel = new TempViewModel(); var binding = new System.Windows.Data.Binding { Source = viewModel, …
marsh-wiggle
  • 2,508
  • 3
  • 35
  • 52
0
votes
1 answer

How to bind a xaml property to a DependencyProperty coming from an extension

I want to create a DependencyProperty in an extension class for FrameworkElement, and bind a xaml property to it. The idea comes from the source code of the Windows Community Toolkit : https://github.com/windows-toolkit/WindowsCommunityToolkit They…
Down
  • 36
  • 5
0
votes
1 answer

Use properties of the base control that is inside the UserControl

How can I use the properties of the controls that are inside a user control without having to use DependencyProperty? Since, if for example I want to use all the properties of a button, I would have to declare all these? And if there is another way…
tlh
  • 1
  • 1
0
votes
1 answer

Using custom attached properties within a plugin leads to an error with Reflection/CreateInstance

I'm working on a program that searches for "plugins" (i.e. .DLL files) in a given directory and then loads them (with Reflection). So far everything works fine. But if I now create a Dependency Property in a plugin project and want to use it, the…
CaptTaifun
  • 321
  • 5
  • 15
1 2 3
99
100