Custom markup extensions in the VS wpf designer
-
I am using VS2008 SP1. I have a solution with two projects. Project A is a class library, and has a markup extension.
public class BadExtension : MarkupExtension { public string A { get; set; } public string B { get; set; } public BadExtension() { } public BadExtension(string a) { this.A = a; } public BadExtension(string a, string b) { this.A = a; this.B = b; } public override object ProvideValue(IServiceProvider serviceProvider) { return A + B; } }
Project B is a wpf project. Part of the code of a window is
Now, the WPF designer refuses to load, saying that no constructor for BadExtension has 1 parameter. However, when I run the app, it loads perfectly and both button texts display perfectly. This is the kicker: In the BadExtension.cs file, if I switch the (string) and (string, string) constructors, the designer now complains about no constructor having 2 parameters. p.s. Or should this be in the Visual Studio forum?
-
I am using VS2008 SP1. I have a solution with two projects. Project A is a class library, and has a markup extension.
public class BadExtension : MarkupExtension { public string A { get; set; } public string B { get; set; } public BadExtension() { } public BadExtension(string a) { this.A = a; } public BadExtension(string a, string b) { this.A = a; this.B = b; } public override object ProvideValue(IServiceProvider serviceProvider) { return A + B; } }
Project B is a wpf project. Part of the code of a window is
Now, the WPF designer refuses to load, saying that no constructor for BadExtension has 1 parameter. However, when I run the app, it loads perfectly and both button texts display perfectly. This is the kicker: In the BadExtension.cs file, if I switch the (string) and (string, string) constructors, the designer now complains about no constructor having 2 parameters. p.s. Or should this be in the Visual Studio forum?
Looks like a bug in the VS designer.
jamie550 wrote:
when I run the app, it loads perfectly and both button texts display perfectly.
It works fine in Expression Blend as well. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Looks like a bug in the VS designer.
jamie550 wrote:
when I run the app, it loads perfectly and both button texts display perfectly.
It works fine in Expression Blend as well. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I have no idea why I didn't begin using Blend a long time ago, for it is so much better in many cases. I think I'll never use the vs wpf designer again, except for editing xaml.
I generally use both VS and blend at the same time....I'm getting more and more used to which stuff works better on one or the other. It's frustrating though - I hate having to leave something out or do something different because something doesn't work in and/or crashes the designer(s). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I have no idea why I didn't begin using Blend a long time ago, for it is so much better in many cases. I think I'll never use the vs wpf designer again, except for editing xaml.
BTW, have you submitted this as a bug on Microsoft Connect? If not, I'll do it.... Cheers, Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
BTW, have you submitted this as a bug on Microsoft Connect? If not, I'll do it.... Cheers, Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Cool. Marked as fixed too. Thank you :) Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: