Note translation: this is a translation of the article
Six years of WPF; what's changed? written on August 3, 2012. Now WPF is not six, but seven years, but nothing has changed.
Before moving to Octopus Deploy full time, I spent a year writing WPF risk assessment systems for traders at an investment bank. Before that, I worked as a consultant, mostly focusing on WPF. For the past six years I have been living and breathing technology, and in this post I want to share some thoughts about the past and the future of WPF and XAML.
Six years ago, I wrote a
WPF validation article on the Code Project. I also wrote
my error provider, which supports IDataErrorInfo , because you won’t believe it! - WPF 3.0 did not support IDataErrorInfo. Later, I worked on several open source WPF projects like
Bindable LINQ (
initial reactive programming for WPF, before the invention of Rx) and
Magellan (MVC for WPF a la ASP.NET). I even spent some time in a club dedicated to praising MVVM and throwing links to the Code Project, known as WPF Disciples (“WPF Proponents”).
')
When I look back at WPF, I see technology with a great foundation that has been corrupted by poor implementation and, more importantly, a lack of financial investment. I am glad that this is in the past for me.
Here's how the markup of a relatively simple window looked back in 2006 (the code was taken from the project I was working on at the time):
<Window x:Class="PaulStovell.TrialBalance.UserInterface.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="clr-namespace:PaulStovell.TrialBalance.UserInterface"
xmlns:tbp="clr-namespace:PaulStovell.TrialBalance.UserInterface.Providers"
xmlns:system="clr-namespace:System;assembly=mscorlib"
Title="TrialBalance"
WindowState="Maximized"
Width="1000"
Height="700"
Icon="{StaticResource Image_ApplicationIcon}"
Background="{StaticResource Brush_DefaultWindowBackground}"
x:Name="_this">
! x:Class! XML! , ?
, 2013- , WPF . :
<Window x:Class="PaulStovell.TrialBalance.UserInterface.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tb="clr-namespace:PaulStovell.TrialBalance.UserInterface"
xmlns:tbp="clr-namespace:PaulStovell.TrialBalance.UserInterface.Providers"
xmlns:system="clr-namespace:System;assembly=mscorlib"
Title="TrialBalance"
WindowState="Maximized"
Width="1000"
Height="700"
Icon="{StaticResource Image_ApplicationIcon}"
Background="{StaticResource Brush_DefaultWindowBackground}"
x:Name="_this">
? . , , .
ASP.NET 2006- ( ):
<%@ Page Language="C#" MasterPageFile="~/TrialBalance.Master" AutoEventWireup="true" EnableViewState="false" CodeBehind="Builds.aspx.cs" Inherits="PaulStovell.TrialBalance.MainWebsite.Builds" Title="Downloads - TrialBalance" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceholder" runat="server">
<asp:PlaceHolder runat="server" Visible="false" ID="_downloadAreaPlaceholder">
<h1>Download</h1>
?
@model BuildsViewModel
@section Main {
<h1>Download</h1>
}
WPF, ASP.NET Web Forms View State. , ASP.NET ,
. Web Forms MVC, ASPX Razor — ASP.NET .
, ASP.NET WPF:
- , (Razor). Razor, . XAML . , , ReSharper' « », .
- -. , WPF MVVM — , WPF , WPF , - MVVM. Blend Behaviors . ASP.NET MVC.
- . ASP.NET MVC, . WPF — .
- . ASP.NET MVC , , . , WPF , internal .
- -. ASP.NET jQuery JSON.NET, - . WPF, MVVM , , .
- -. ASP.NET MVC , ASP.NET - . WPF — , , , WPF: (. .: VirtualizingStackPanel).
, . CSS? Less SASS. JavaScript? CoffeeScript Dart. ; , WPF 2006- .
ASP.NET WPF , , ASP.NET — , . , , . , .
, , WPF . , , , , (
. .: WPF).
, , . , . , CSS ( WPF , , WPF, HTML; , ).
(bindings) (Just Works), , . INotifyPropertyChanged
. - (data contexts) — , ContextMenu. ICommand : WPF routed commands, Blend — command; ICommand , .
XAML
— XAML. XAML , , . ! Blend, Visual Studio, XAML. 2013-, , Blend, XAML. Visual Studio 2012 .
XAML . , . HTML, XAML . , . , .
, XAML:
- , .
- , .
- .
- C# .
- Visibility .
- .
ASP.NET (Razor), WPF?
MVVM
, , WinForms, , MVVM — , Silverlight Unleashed MVVM Light.
WPF, , , , , MVVM , - Code Project. WPF ViewModelBase, , - INotifyPropertyChanged. 20 , Button1_Click, — , MVVM, , , - -, , MVVM .
MVVM , , WPF , WPF , , . .
, WPF, , , . ASP.NET (- Web Parts ASP.NET 2.0?)
: ASP.NET . - . , . WPF 2006- .
, . ASP.NET Ruby PHP — , . Windows WPF.
WPF. , XAML — , , . 2006-, , . , . , , WPF , ASP.NET.
, , WPF. , - … Qt, , C++ , C# . JSON, JavaScript', — XAML Setter.Value?
WPF
? MVVM ? ViewModelBase? BoolToVisibilityConverter IsNotNullConverter?
, WPF . , . , , Microsoft WPF...