Improve the functionality for wpf demo