What features of WPF that are available through XAML are not available through C# (or VB, ...)
Is it possible to use all WPF functionality in C# (VB, ...)? O开发者_高级运维r is there any maybe advanced functionality that is not directly accessible from C#? (Maybe because it might not be accessible by public methods but rather internal.)
Nothing. In fact, the actual parsing and processing (assignment of values to properties, binding to events, ...) of XAML files are eventually done by imperative C# code.
It can, however, be more tedious to set object properties using C#/VB directly; UI designers may know XAML but not C#/VB; and XML is perhaps more toolable than C# source. These factors make XAML a useful technology.
I think some design-time-only features like d:DataContext
, d:DesignWidth
and d:DesignHeight
are only available in XAML, but that's about it. You can do everything else in C#/VB.NET
精彩评论