dependency-properties

Is there a list of Attribute classes that can be applied to a DependencyProperty?

I'm working on a problem that seems like it might be solved by applying an Attribute to the DependencyProperty. I got curious and I can't find documentation that lists all the XXXAttribute classes that apply to DependencyProperties and what the attributes are used for. Does anyone know of anything like that? If not, maybe post some at...

What is wrong with my dependency properties?

I'm having a problem with my dependency property. It seems like it doesn't want to work at all, and I don't know why. Here is the code for my dependency property: public static readonly DependencyProperty CheckBoxColumnVisibilityProperty = DependencyProperty.Register("CheckBoxColumnVisibility", typeof(Visibility), typeof(Computers...

Dependency Property and ViewModel initialization problem

I am trying to add my own ItemsSource to provide a list of GraphViewModels to a chart. I dont think I have it quite right though, as when I create my first GraphViewModel and add it to the Graphs, my DP is updated, but OnGraphsCollectionChanged is not called. How is this supposed to work? If I add graphs to my VM property via a button ...

Visual Studio underlines existing Dependency Properties

How is it possible, that some custom Dependency Properties from a Custom WPF Control are in Visual Studio WPF Designer underlined like a Non-existing properties, but in reality they are defined and everything works well ? Thanks ...

How do I add a dependency property to an image in WPF?

How do I add my property called weight to an image and use it like this:? myImage.weight (assuming i have already defined myImage in XAML) here's my code: public partial class MainWindow : Window { public double Weight { get { return (double)GetValue(WeightProperty); } set {...

Infinite recursion error using DependencyProperty (C#)

Here's the C# code directly from the website (http://jobijoy.blogspot.com/2007/10/time-picker-user-control.html) that everyone refers to when someone asks about TimePicker for WPF, although I moved it around a little bit to be more organized. (Please note, if you're trying to run this code to work with it: you must change the XAML code ...

Silverlight 3 - Passing a binding value to a behavior through XAML

Hi, I have created a custom behavior that I can pass properties to fine, currently just strings, my behavior looks roughly like this: public class ImageSourceBehavior : Behavior<Image>, INotifyPropertyChanged { public static readonly DependencyProperty ImageDirectoryProperty = DependencyProperty.Register("ImageDirectory", type...

Create a ControlTemplate that will trigger on Certain values of their DependancyProperties

I want to create a ControlTemplate that will trigger on vertain values of their DependancyProperties for example a different image appear on a button Anyway there are reasons why I need DependancyProperties This is a sample of what could be in my user control .. I have just shown a simple example of an effect triggered by a property cha...

Add bound DependancyProperty to button to control image displayed

Here is a simplification of the problem I want a Button with an extra DependancyProperty that I can bind to. The value of this property will control which image is selcted on the button. Question 2 is do I create a UserControl and draw the button on. If so how do I can use triggers to manage the image BUT I do not know how to do the T...

Silverlight Dependancy Property Change Event Problem

I have a custom control that has a Dependancy Property...it has a few but let us say Dragable is my problem. The property is a boolean and I want to execute a piece of code each time it changes...a toggle. I have two options, both shown below [Category("Modal Options")] public bool Dragable { get { return (bool)GetValue...

How to aggregate bindings in Silverlight UserControl

Imagine a UserControl containing some sort of ItemsControl. The UserControl as a whole has a DataContext, but you also need to expose the ItemsSource of the ItemsControl. I have tried all manner of arrangements, and eventually passed a DomainDataSource as a UserControl dependency property named DDS, and bound the ItemsControl like this:...

Getting a DependencyProperty by name in Silverlight. How to...?

Situation: I have a string that represents the name of a DependencyProperty of a TextBox in Silverlight. For example: "TextProperty". I need to get a reference to the actual TextProperty of the TextBox, which is a DependencyProperty. Question: how do I get a reference to a DependencyProperty (in C#) if all I got is the name of the prope...

Create Properties or DependencyProperties that have Code Completion in XAML

Hi, I am trying to create DependencyProperties that have a nice drop down code completion when using them in the XAML-editor in Visual Studio. Many default SilverLight framework properties have such completion, e.g., Background or BorderBrush. Also, Boolean Properties show the True/False selection in the XAML-editor. The same holds true...

How to expose xaml properties?

I created a ComboBox subclass and added my functionality. Now I want to expose external properties of the TextBox for example: <a:MyComboBox SpellCheck.IsEnabled="True" TextBox.SelectedText="{Binding X}" /> Is this possible, I maybe didn't choose the wrong particular property but I guess you understand what I mean. Is this possible?...

Create Dependency Properties for setting Custom EventHandlers in XAML

Hi, i want to do add custom event handlers to default framework elements using DependencyProperties. Something like the following: <Border custom:MyProps.HandleMyEvent="someHandler">...</Border> Here is the code behind for the control that contains the Border element: public class MyPage : Page{ public void someHandler(object se...

Setting up binding to a custom DependencyProperty inside a WPF user control

I have a WPF UserControl containing a custom DependencyProperty named MyDP. I want to bind this to a property on my ViewModel (which is injected as the UserControl's DataContext). I know one way to do it by setting the binding in the UserControl's declaration in the parent window's XAML as such: <Window x:Class="MyNamespace.Views.Main...

DependencyProperty PropertyChangedCallback causes NullReferenceException in XAML

I've got a subclassed UserControl that is the content for my main window. I added a DepedencyProperty to my usercontrol, of type ResizeMode, and the PropertyChanged callback sets the ResizeMode of the main window to the value correctly. It runs fine. I can set it from the code behind, or from the XAML, and it works correctly. However, w...

WPF: What distinguishes a Dependency Property from a regular CLR Property?

In WPF, what, really, does it mean to be a "dependency property"? I read Microsoft's Dependency Properties Overview, but it's not really sinking in for me. In part that article says: Styles and templates are two of the chief motivating scenarios for using dependency properties. Styles are particularly useful for setting properties...

DependencyProperty are Null when trying to bind to a control lower down in XAML.

Hi. I have the following code XAML code. <Grid> <code:TSScrollViewer x:Name="scrollViewer" Zoomer="{Binding ElementName=zoomer}"> <code:DesignerCanvas x:Name="designerCanvas" Background="white" /> </code:TSScrollViewer> <code:TSZoomer x:Name="zoomer" Grid.Row="0" Grid.Column="1" ControlToZoom={Binding ElementName=d...

Best practice for forwarding ItemsSource

I have a UserControl that contains - among other things - a ListView. The ListView has a different data context than the UserControl (this data context is not exposed). If someone consumes my control, I would like them to be able to (indirectly) bind to the ListView's ItemsSource dependency property. It should really feel like the use...