icsharpcode / WpfDesigner

The WPF Designer from SharpDevelop
MIT License
949 stars 251 forks source link

Adding attached property breaks "Design" mode #22

Closed javidang closed 7 years ago

javidang commented 8 years ago

Hi. It is not critical issue, I find "hacky" solution for this, but it is curious why this happens. The problem is if I add attached property to something programmaticly or in "XAML" mode (event trigger in my example), switching to "Design" mode not updates document, i mean it is still in "XAML" mode. I tried to find if generated window becomes null or some inner exception happens, but nothing, window is generated, and all functions act normal. Added example xaml as file.

New1.txt

jogibear9988 commented 8 years ago

I'm on it! The Problem is that this Attached Properties use another Name for the Property as for the Field. I look how I solve this.

javidang commented 8 years ago

I currently tried to add those related assemblies (System.Windows.Interactivity and Microsoft.Expression. Interactions) during loading settings. It know switches to design mode, but element that uses attached property is not shown, and error tab complains about "attached property Interaction.Triggers not found" . It is more related to given example (System.Windows.Interactivity) I think. Google says it is Blend stuff, and it will work if you run it, but compiler will keep complaining. And if there is error, the element that related will be dropped from design.

jogibear9988 commented 8 years ago

As I said, WpfDesigner always looks for a Public Property ... Property, wich has a coresponding Get/Set Method! And this does not work there! I've started a fix, but I think I will not finish it before tuesday

jogibear9988 commented 8 years ago

I've now got it working, but the Property is not yet displayed in the Property Grid! Problem is that it's a AttachedProperty, wich uses a Name for the Property wich is not the Same as the Static Object. Also the Static Object is Private, and if you call "TypeDescriptor.GetProperties(System.Windows:interactivity.Interaction)" you get no result!

jogibear9988 commented 8 years ago

I'm not sure atm, how to solve this!

jogibear9988 commented 8 years ago

Should now work, for the PropertyGrid, I'm still looking for a Solution