This sample shows how to have animation while scrolling.
The UI is made up of a Grid with 3 columns with buttons for scrolling left and right and a listbox in the middle.
we are going to scroll horizontally 3 items at a time.
ListBox’s ItemsSource is set to a range of numbers 1-20
list1.ItemsSource = Enumerable.Range(1,20);
In the code [...]
Read Full Post »
Posted in Silverlight on May 22, 2008 | 4 Comments »
This sample shows how to animate the item in a listbox that is being deleted.
The sample would be lot cleaner, if Triggers , the ListBoxItem is exposed(instead of us keeping track of the items) and x:Static are supported
Note:Actual logic to delete which should be done after the animation is complete is not there
you can see [...]
Read Full Post »
There are places in which we want to show the details of an Item(ex. listboxitem) when it selected. As it is not easy to get the actual item(listbox item), we have to add some code to get a handle to the control when the controls are getting loaded
lets say we have this XAML
<UserControl x:Class=”SilverlightApplication10.Page”
xmlns=”http://schemas.microsoft.com/client/2007“
[...]
Read Full Post »
Posted in Silverlight, tagged Scrollviewer on May 9, 2008 | 1 Comment »
Here is one way to control a ScrollViewer without Scrollbar
Let say we have this basic UI
A button on the left to scroll to the left, A button on the right to scroll right and ItemsControl between the buttons which is what we are going to scroll when the buttons are clicked
<UserControl.Resources>
<DataTemplate x:Key=”dt”>
<TextBlock Margin=”5,0,0,0″ [...]
Read Full Post »
Posted in Silverlight on May 1, 2008 | 2 Comments »
This is a sample implementation for a ratings control. we can customize the shape by setting the template to something different. It defaults to stars but can be changed easily
Here are the sample templates used
<Canvas Width=”600″
Height=”600″>
<local:RatingSelector Canvas.Left=”50″
Canvas.Top=”100″
Width=”200″
Height=”20″
MinRating=”1″
MaxRating=”4″>
<local:RatingSelector.RatingTemplate>
<ControlTemplate TargetType=”local:RatingItem”>
<Ellipse Width=”10″ Margin=”2″
Height=”10″
Fill=”{TemplateBinding Background}”
Stroke=”Black”
StrokeThickness=”1″>
[...]
Read Full Post »