简体   繁体   中英

Is it possible to plug dependency property framework to Winform or ASP.NET?

The dependency property framework is a general UI Framework that can be needed outside WPF. So is there a way to use it for Winforms or ASP.NET UI for example ?

Update: I mean can I declare a few namespaces and use dependency property framework in winforms and asp.net ?

I vaguely remember trying to use Routed Events in my own non-WPF code, and it turned out to be a nightmare. Both Routed Events and Dependency Objects need to be owned by DependencyObjects, which in turn inherit from System.Windows.Threading.DispatcherObject. At the very least, it would be horribly ugly -- if not impossible.

I would suggest using INotifyPropertyChanged and INotifyCollectionChanged etc. instead if you can. It's a little more code per property since you need a backing field and to call the NotifyChanged event, but it's much more straightforward.

Most .NET IoC containers and dependency injection frameworks work within the confines of the framework.

This means they can work with ASP.NET and Winforms.

If this is not what you are asking, can you please clarify your question? It is not entirely clear what you are asking.


In regards to dependency properties (now that I understand exactly what you are talking about):

You can use them in winforms and webforms, since these are also written in .NET. As you posted in your comment, yes, simply importing several namespaces should be enough.

What features of the dependency property sub-system after you after? If you're specifically after binding support, you could something like Truss as a general binding manager.

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