Customize UXFlow Appearance Based on Item Position

The latest ClientUI release (2011 R2 SP1) introduces several enhancements for UXFlow control. Some of the significant enhancements are the new AutoReflection property and PositionStates visual states. They are introduced to set different styles in UXFlowItem according to its position.

The new PositionStates enhancement enables you to customize the layout and appearance of the item based on the flow position. See the following illustration.

Customize UXFlowItem based on the position

In this blog, I’m going to share how to achieve the above scenario in a step-by-step walkthrough.

1. Put additional text to the UXFlowItem.

You will need Microsoft Expression Blend to edit the ItemContainerStyle of the UXFlow control.Edit ItemContainerStyle

After the generated template is shown, put the text in CoverElementPerspective. CoverElementPerspective contains the ImageLoader of UXFlowItem. That’s the reason why the text requires to be put in that element. In this case, TextBlock is used as the text.

To easily maintain the layout, let’s use Grid and StackPanel container with configuration as shown below:

2. Implement the visual state and switch the position by using PositionStates in VisualStateGroup.

As stated before, PositionStates is available only in the SP1 release.

The PositionStates is automatically generated after you use EditItemContainer template.

Center is the default state when an item is selected. Therefore, you only need to customize position, animations and styles for the LeftSide and RightSide.

3. Set AutoRefreshReflection to true.

When using the default UXFlow configuration, the reflection will be automatically cached. This may cause a reflection issue while switching the styles. To avoid this issue, simply set AutoRefreshReflection to true.

You can also download the sample project for your references.

I hope this post can give you some insights about styling with UXFlow control. As usual, feedback and comments are always welcome.

Warm Regards,
Handy

Leave a Reply