开发者

Hiding Binding Properties in Expression Blend

开发者 https://www.devze.com 2023-01-25 12:14 出处:网络
This is my first ever post here so be gentle :). We have a C# solution that is currently based around Windows Forms and we are moving forward with WPF. Our software is not 100% suited to the MVVM way

This is my first ever post here so be gentle :). We have a C# solution that is currently based around Windows Forms and we are moving forward with WPF. Our software is not 100% suited to the MVVM way of separating data from view but it ALMOST there. In other words we almost have a view model. The problem is that 'viewmodel' has a whole bunch of properties etc that I would like to hide from the Bin开发者_如何学编程dings when displayed through Expression Blend. If I understand this correctly Blend will just reflect on the class to show available properties. The question is - how do I hide these properties for appearing in the list?

I totally understand that if starting from scratch this would be in a separate class and I would have no problems. But moving all this out into another class now would break all of our customers code that relies on the code the way it is. Aggregation is definitely better here but it's a non starter so I'm hoping there's some attribute out there that we can decorate our properties with to hide.

Apologies if this is a basic question or I have not made total sense!


One way would be to convert your properties to literal get/set methods. It wont break your code unless you are using the properties for other things than binding that requires them to be properties, and Blend is only watching for properties AFAIK. This is a refactoring available in Code Rush Express which is free. Other refactoring tools may have it as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号