dependency-properties

How do i reset a DependencyProperty back to it's default value in xaml

question as above ...

Handling DependencyProperty changes in the ViewModel of a UserControl.

Hi. Im currently trying to get my first WPF Usercontrol to work. It consists of some UI elements and a ViewModel, holding the data and doing the work. It has a List of items as input, and another List of items as output. I need a certain task in my ViewModel to be done, when the list bound to the input changes. But i can't find a way to ...

target property must be a dependency property - why?

I understand that dependencies properties serve a major purpose in WPF. However I do not get the reasons behind the restriction that in binding, the target property must be a dependency property. Why can't it be any property? ...

Dependency property quesion regarding design.

Hi, I have 2 custom controls that are independent of each other in a wpf application. However, I have some behavior that needs to replicated in both the controls that is similiar. For example, when a user does drag drop on either of these 2 controls, i need more or less the same behavior to execute. The same behavior also consists of ...

DependencyProperty.Register() usage?

Hi, I have 2 controls A and B that need to share a dependency property. A has the property defined as: public static readonly DependencyProperty PathProperty= DependencyProperty.Register("PathProperty", typeof(string), typeof(A), new PropertyMetadata(string.Empty, OnPathChanged)); public string Path { get {...

Can I get notified of changes to a DependencyProperty that I did not create?

I am using a 3rd party control that exposes a bunch of dependency properties (ex: SomeNumber) but do not supply corresponding changed events (ex: SomeNumberChanged). I would like to handle the event when the value changes. I know there is the OnPropertyChanged callback when you register the DP, but is there a way to hook into this when...

silverlight binding to a dependency property in a custom control

I've got a custom control ive created that is instanced in my view, in my custom control (a text box) i have a dependency property set up which is bound to the text value, this all works correctly and updates. However I now want to bind a dependency property of my view to the dependency property of my control but I cant get this to quite...

WPF - How to bind to a Dependency Property of custom class

I'm once again in WPF binding hell :) I have a public class (Treatment) as follows: public class Treatment() { ... public Ticker SoakTimeActual; ... } Within Ticker is a Dependency Property: public class Ticker : FrameworkElement { // Value as string public static readonly DependencyProperty DisplayInter...

Silverlight UI element's 1-time binding to nested non-dependency property fails

I want a 1-time databind between a checkbox (IsChecked propety) in a childWindow and a nested member variable in it's DataContext object, such that only the initial IsChecked property is set by the member variable. The member variable (binding source) is not INotifyPropertyChanged or marked as a DependencyProperty- but I think that is ok...

DependencyProperty dependencies and PropertyCallbacks

The heart of the question in this post is whether you can expect all DPs to be set by the time a Property callback for one of them is set. I ask this because this is not the behavior I am seeing. A class has two DP's, both of which are set in XAML, like so: <!-- Days of the Week --> <local:DayOfTheWeekColumn DowIndex="0" Acti...

Question about a Dependency Property example

In the book Visual C# 2010 Recipes: A Problem-Solution Approach, there is an example demonstrating the power of Dependency Properties. The example describes a UserControl that has two properties TextFontWeight and TextContent that have the dependency properties TextFontWeightProperty and TextContentProperty attached to them respectively....

CollectionType Dependency Property

Hi Based on this tutorial: http://www.dotnetfunda.com/articles/article961-wpf-tutorial--dependency-property-.aspx I've created my usercontrol like this: usercontrol xaml: <UserControl x:Class="PLVS.Modules.Partner.Views.TestControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sche...

WPF: Dependency Properties and DataContext

I was working on creating a reusable custom control (not a user control) in WPF. I created the XAML in the Themes/Generic.xaml file and I setup the "lookless" functionality in the control's CS file: AddressField.cs using ...; namespace MyNamespace { [TemplatePart(Name = AddressField.ElementAddress1TextBox, Type = typeof(TextBox...

How can I bind to dependency properties of a custom control from a resource dictionary defined in Generic.xaml?

EDIT: I rephrased the entire question. Hello everybody, I have a custom control with dependency properties. In the Generic.xaml file I have a resource dictionary. It's a resource dictionary within the outer dictionary, defined like so: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http...

Why can I no longer bind GradientStop Color to a Dependency Property of my control?

The summary of my problem: I had created a UserControl where I bound my dependency property "Scheme" to the Color property of a GradientStop, and it worked perfectly. Now, after converting my UserControl to a custom control, this binding no longer works, and I don't know why. EDIT: Replication of Custom Control Problem: http://www.mega...

WPF binding not applying to target after initialization

Hi all I am trying to add Series binding to the Visifire graphing controls set. To this end i have created a SeriesSource dependency property of time DataSeriesCollection. This is bound in the front end using: `<Chart SeriesSource={Binding Series} />` Problem When the source changes, the validation callback is called. The value th...

WPF changing Background of a label within UserControl using DependencyProperty

Hi. I have a very simple UserControl as shown below. I'm trying to get the background of the Label element to change whenever a property in the control changes, but it's not working: when I change the Selected property on the control instance, the label's background color does not change. Thanks! Code behind: public static readon...

Set Label Content with a Dependency property

I have trouble to understand how dependency properties can be used between C# and xaml code. This is a smal code example of my question XAML code: <Window x:Class="WpfChangeTextApplication.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Tit...

WPF, cannot bind a property because it says it's not a DependencyProperty, but I registered it

I have a UserControl with a Template property that I've set up as a DependencyProperty: public partial class TemplateDetail : UserControl { public static readonly DependencyProperty _templateProperty = DependencyProperty.Register( "Template", typeof(Template), typeof(TemplateDetail) ...

How do I expose custom control properties inside a user control?

I have a custom control called TextBoxWithLabelAndUnits. From the name, you can tell that it's a TextBox that has a Label before it and a Label after it, so that the custom control looks like this: ----------------- Label: | | units ----------------- I expose several dependency properties to configure the c...