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

WPF: Attached behavior is registered but never called?

trying my first attached behavior: I want to bind the TextSelection of the RichTextBox to my ViewModel`s property: public TextSelection SelectedRichText {get;set;} That way I bind it:
msfanboy
  • 5,273
  • 13
  • 69
  • 120
-1
votes
1 answer

Binding a Parent DataContext from within an ItemTemplate in Windows Store Apps

I got a problem binding an ItemTemplates Parent context inside an item template. There are plenty of "workarounds" which only work in WPF (i.e. using FindAncestor and AncestorType). This are out of question, as it's not supported in Windows Store…
Tseng
  • 61,549
  • 15
  • 193
  • 205
-1
votes
1 answer

how to I connect bind attach a naked boolean type to a checkbox in windows presentation foundation c# code behind

how do I bind/connect/attach or otherwise make a checkbox directly change the boolean value of a variable without writing a wrapper for the boolean function in c#? Q I have been writing c# code behind for various events related to a checkbox,…
-2
votes
1 answer

WPF use attached property before running app

I have a WPF project using .Net Framework 4.7.2 (I have to use this version). The project uses a StackPanel that contains two Buttons. Since there is no Spacing property for the StackPanel I made my own which adjusts the margin of every child…
hiddenUser
  • 35
  • 7
-2
votes
1 answer

How to Implement Attachable Properties for ItemTemplate and ItemsSource

I am trying to use the WPF Grid as an ItemsControl using attached properties for the purposes of creating a scalable Piano Keyboard. Each key in the keyboard may span 1 to three columns depending upon what precedes and succeeds it and will span 1…
Sphynx
  • 135
  • 2
  • 12
-2
votes
3 answers

How to find if a property is attachable or not in wpf ?