Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Designer Attached Properties

I am using attached properties to allow some design-time behaviour in the Visual Studio WPF designer i.e. design-time view-model data.

The issue I'm having is that when attached property events fire at design-time for my UserControl, the type of the DependencyObject is UserControl and not the concrete type I am expecting. At runtime the type of the DependencyObject is the concrete type as expected, e.g. BlingUserControl.

I want access to the concrete type as I need its namespace for a convention-based locater pattern.

Is there any way of getting at the concrete type at design-time?

like image 360
Tim Lloyd Avatar asked Mar 27 '26 17:03

Tim Lloyd


1 Answers

Afraid not. Visual Studio (and Blend, for that matter) both construct an instance of UserControl rather than an instance of your control itself.

like image 166
Kent Boogaart Avatar answered Mar 29 '26 09:03

Kent Boogaart



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!