Posts

Showing posts from 2010

An easy Windows Phone 7 Photo Viewer using Pivot control #WP7 Tip

Image
Technorati Tags: WP7 , Windows Phone 7 , XAML , Pivot   Source Code Here is a small trick using the Pivot control for a Photo viewing experience. Imagine a Pivot control with out any header and the image as Pivot items. Yes it is that easy :). Since the Pivot supports for the Phone orientation you can enjoy the picture viewing both in Portrait and Landscape. I am giving step by step info if you are totally new to WP7 and XAML styling. And please note that the performance wont be that great if you have many images in the Pivot control. So you may need to do design that around or use some tricks to clean up the memory well. 1) Place a Pivot control and override the Style. What we wanted is to take out all the Header Templates and other extra puddings.         <Style x:Key="emptyPivot" TargetType="controls:Pivot">             <Setter Property="Template">                 <Setter.Value>                     <Co

UniformGrid for Silverlight

Image
Technorati Tags: Silverlight CustomPanel XAML UniformGrid WPF My recent Silverlight project had a need to distribute the items in rows and columns. I had to dynamically calculate the number of columns and rows it needed based on some logic. So it was clear that I need UniformGrid as in WPF so that I can bind my ViewModel properties to Rows and Columns properties of the Panel. But it was a bit surprising to me that there isn’t a Silverlight UniformGrid either in Silverlight SDK or in Silverlight ToolKit. So here is one I ported from WPF. Check out the Silverlight 3.0 demo below. You can also download the sample project

A Simple Accordion banner using ListBox

Image
This sample is to show how easily we can create an Image-accordion entirely in Expression Blend. This is utilizing the ListBox’s Selected and UnSelected VisualStates. Place a ListBox and override its ItemContainerStyle then adjust the width on the Selected and UnSelected visual states. When we override the ItemsPanel we can make it orientation to Horizontal on the StackPanel. Pretty easy and there is no C# needed. Paste the below XAML in your user control <UserControl.Resources> <ItemsPanelTemplate x:Key="ItemsPanelTemplate1"> <StackPanel Orientation="Horizontal"/> </ItemsPanelTemplate> <Style x:Key="ListBoxItemStyle1" TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem">

Button Style - Silverlight

Image
Really surprised to see from the google analytics that one of my old post regarding WPF control template still has many viewers . So I just thought of creating a Silverlight version of the same. All the buttons are from the same style with different Button.Background, the elliptical one has less height and more width on it. If you want to check out the XAML, please download from here