WPF rewrite