refactoring from winforms to xaml