Blog: XAML

A transparent undo/redo mechanism for XAML applications

February 23, 2015, (updated on February 25, 2017), Software Development

In one of my recent projects, I had to implement an undo/redo mechanism for an observable object graph. The usual approach to this problem is to implement commands which operate on the object graph and provide Do() and Undo() methods. The problem was, that a great portion of the business logic was already implemented and was not command-based. This is why I had to find a solution which works transparently on the property change events of an object graph whose objects implement the INotifyCollectionChanged interface and use the ObservableCollection class for collection properties. The solution to the problem was to […] Read more...

Tags: , , , , ,

Recommendations and best practices for implementing MVVM and XAML/.NET applications

January 30, 2015, (updated on June 15, 2018), 37 comments, Software Development

In this article I’ll describe the rules and practices I’m following for XAML and MVVM application development. I’m using the described techniques since multiple years and they have proven themselves for me. Most of the described rules apply for all types of XAML projects – Windows Store, Windows Phone, Silverlight and WPF projects. Sample code: The source code of the application Visual JSON Editor contains sample implementations for most of the discussed recommendations. Some sample code snippets in this article use the MVVM classes from the MyToolkit library which is developed by myself. Project file structure All MVVM/XAML applications should […] Read more...

Tags: , , , , , , ,

Jumpy ListBox while scrolling in Windows Phone 7.5

April 2, 2012, (updated on September 6, 2014), 7 comments, Software Development

I recently discovered a bug in the ListBox control for Windows Phone 7.5. In a long list of items (virtualizing list, items with different heights), the list sometimes begins to get jumpy and the list cannot be scrolled to the end. To reproduce the problem, open a long list of items, scroll a little bit, stop the scrolling and tap on an item. Now if you start scrolling again the list begins to get jumpy… This video shows the problem: After trying out a lot of possible workarounds and tweaks, I finally found the solution: Simply set the focus to […] Read more...

Tags: , ,

Reusable page transition animations in Windows Phone 7/8 Silverlight

March 4, 2011, (updated on September 14, 2014), Software Development

I searched a while finding a simple solution to add transition animations for my Windows Phone 7 application. There is a simple solution using the Silverlight for Windows Phone Toolkit. After the installation of the toolkit (using traditional installer or NuGet) and referencing it in your project, open your App.xaml and insert the following code: <Application.Resources> <ResourceDictionary> <Style x:Key="Transition" TargetType="phone:PhoneApplicationPage"> <Setter Property="toolkit:TransitionService.NavigationInTransition"> <Setter.Value> <toolkit:NavigationInTransition> <toolkit:NavigationInTransition.Backward> <toolkit:TurnstileTransition Mode="BackwardIn"/> </toolkit:NavigationInTransition.Backward> <toolkit:NavigationInTransition.Forward> <toolkit:TurnstileTransition Mode="ForwardIn"/> </toolkit:NavigationInTransition.Forward> </toolkit:NavigationInTransition> </Setter.Value> </Setter> <Setter Property="toolkit:TransitionService.NavigationOutTransition"> <Setter.Value> <toolkit:NavigationOutTransition> <toolkit:NavigationOutTransition.Backward> <toolkit:TurnstileTransition Mode="BackwardOut"/> </toolkit:NavigationOutTransition.Backward> <toolkit:NavigationOutTransition.Forward> <toolkit:TurnstileTransition Mode="ForwardOut"/> </toolkit:NavigationOutTransition.Forward> </toolkit:NavigationOutTransition> </Setter.Value> </Setter> </Style> </ResourceDictionary> </Application.Resources> This XAML code contains the style, every […] Read more...

Tags: , , , ,

  Page 1 of 1