简体   繁体   中英

Design Time Bindings Visual Studio 2010 vs Visual Studio 2008

I have a custom Binding class derived from original Binding class where in its constructor I just apply default values to some of its properties: Source , Path , Mode , Converter , and so on.

The goal of this custom class is that the developer has to apply only the ConvertParameter property in XAML.

Now because this binding applies to properties like TextBlock.Text I want to give an indication to the developer, otherwise he will see nothing during design time. So in my defined Converter I return by default the value of ConverterParameter if I cannot retrieve the value I want based on Path and Source . As I said I do that just for design-time, so that the Text of the TextBlock is not blank and have an indication of what it is going to be there during runtime.

During runtime this works perfectly fine in both versions.

But during design-time this works in Visual Studio 2008 but not anymore in Visual Studio 2010.

The difference and my problem is that in Visual Studio 2010 neither the constructor of the binding nor the Converter is running during design-time something that was working in Visual Studio 2008.

I tried to use FallbackValue which also worked in 2008 during design-time but it is also not working anymore in 2010.

Do you know this issue? Is there any setting in Visual Studio 2010 that will enable the same behavior as in Visual Studion 2008 regarding that?

I don't want to have demo design data. I want to show in desing-time, for example in the TextBlock.Text , the value that the developer defined in XAML for ConverterParameter .

Thank you in advance!!

I found a workaround by creating a MarkupExtension . Although this was not needed in any case including mine in Visual Studio 2008, in 2010 seems like mandatory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM