Questions tagged [attached-properties]

In Windows Presentation Foundation (WPF), attached properties are a specialized form of dependency property that does not have the conventional property "wrapper".

An attached property is intended to be used as a type of global property that is settable on any object. It allows different child elements to specify unique values for a property that is actually defined in a parent element (Grid.Row and Grid.Column are an example of frequenly used attached dependency properties).

General information: Attached Properties Overview

458 questions
11
votes
3 answers

Displaying FontFamily in Combobox

My goal is to manipulate the text-styles of my application via DependencyProperties. I got a diagram in which the texts are to be manipulated in size, fontfamily, color, etc. So I'd like to use an interface similar to a rich text editor like…
Torsten
  • 1,696
  • 2
  • 21
  • 42
11
votes
3 answers

Reducing boilerplate code in MVVM WPF app for attached properties, commands, etc?

I'm working on a WPF MVVM application. The thing that I'm noticing is that I have to write an inordinate amount of boilerplate code just to declare commands (through DelegateCommands from the WPF Team's MVVM Toolkit), attached properties and…
djcouchycouch
  • 12,724
  • 13
  • 69
  • 108
10
votes
1 answer

Can't bind an attached property to another dependency property

I' writing a control library. In this library there are some custom panels which are populated with user UIElements. Since every child element in my lib must have a "Title" property, I wrote the following: // Attached properties common to every…
Trap
  • 12,050
  • 15
  • 55
  • 67
10
votes
1 answer

Get and set WPF custom attached property from code behind

I generate objects of framework Rectangle class (which is sealed) and programmatically add them to Canvas. I want to add some information to that objects. Is there such a possibility? I can get and set attached properties in XAML but these is not…
Dawid Jablonski
  • 523
  • 4
  • 15
9
votes
1 answer

Attached Property Changed Event?

ist there a way to get a change notification if an attached property changed? A simple example is a Canvas with a Rectangle in it. The position of the Rectange is set by using the DepenendyProperties Canvas.Top and Canvas.Left. I'm using an Adorner…
Michael Menne
  • 155
  • 1
  • 2
  • 6
9
votes
6 answers

Set the binding value directly

Is it possible to set the value behind a two-way binding directly, without knowing the bound property? I have an attached property that is bound to a property like this: Now I want to change the…
poke
  • 369,085
  • 72
  • 557
  • 602
8
votes
1 answer

Add DataBinding for attached Property per Code Behind

I want to add a DataBinding per Codebehind for an attached Property and want to show the Canvas.Left property in a TextBox. How do I add this property?
Taladan
  • 429
  • 1
  • 8
  • 20
8
votes
1 answer

Setting focus to a control in WPF using MVVM

I want keyboard focus to be set to a TextBox when I click a Button on my view. I don't want to use any codebehind, so wondered if anyone had written an attached property or similar solution?
devdigital
  • 34,151
  • 9
  • 98
  • 120
7
votes
2 answers

Binding ContextMenu property to owner property

I have a problem with binding a context menu to textbox's attached property. So I have TextBox and it has a context menu on right click. So how to bind context menu's property to TextBox's attached property in WPF XAML? Here I trying bind to TextBox…
Qutfullo Ochilov
  • 303
  • 1
  • 10
7
votes
2 answers

Why is XamlReader.Load unable to recognize my attached property in Silverlight 4?

I'm trying to figure out how to programmatically apply a theme at runtime in our Silverlight 4 application. I figured this should be as simple as loading a resource dictionary from XAML and merging it with the application's merged dictionaries. …
Jacob
  • 77,566
  • 24
  • 149
  • 228
7
votes
1 answer

WPF - Handling custom attached events on custom controls

I have a routed event declared as such (names have been changed to protect the innocent): public class DragHelper : DependencyObject { public static readonly RoutedEvent DragCompleteEvent = EventManager.RegisterRoutedEvent( …
jmp
7
votes
2 answers

Read-only attached property in trigger (WPF)

I have a problem with read-only attached property. I defined it in this way : public class AttachedPropertyHelper : DependencyObject { public static readonly DependencyPropertyKey SomethingPropertyKey =…
Developex
  • 328
  • 5
  • 11
6
votes
1 answer

Attached properties order

What is the order in which attached properties are applied to an object ? I guess I should ignore this, but here my scenario: I've got an attached property to stick the VM to the View, and then, another attached property that depend on the first…
Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
6
votes
2 answers

DependencyProperty of Type Delegate

I have created an attached behavior that is used to execute a Delegate of type Func when the behavior is invoked. Below is the dependancy property definition. public static readonly DependencyProperty SendToDetailBehaviorProperty =…
6
votes
1 answer

How to change RelativePanel attached properties in Windows Apps?

I have tried to change the RelativePanel attached properties of a control by XAML in the VisualState.Setters in a Visual State but the properties do not change, so I created a dependency property to test by code behind and neither. Is there any way…
1
2
3
30 31