[Back to Silverlight 2 Toolbar]
Box.xaml:
<UserControl x:Class="Silverlight2ToolBar.box" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="50" Height="50"> <Canvas x:Name="boxcanvas" RenderTransformOrigin="0.5,0.5" Canvas.ZIndex="0" MouseLeftButtonDown="boxcanvas_MouseLeftButtonDown"> <Image x:Name="Thumbnail" Width="50" Height="50" Stretch="Uniform" Cursor="Hand" Source="images/nibbles.png"/> <Image x:Name="Thumbnail_Reflection" Width="50.879" Height="50" Stretch="Uniform" Cursor="Hand" RenderTransformOrigin="0.5,0.5" Canvas.Left="-0.097" Canvas.Top="43.363" Opacity="1" Source="images/nibbles.png" > <Image.RenderTransform> <TransformGroup> <ScaleTransform ScaleY="-0.75"/> </TransformGroup> </Image.RenderTransform> <Image.OpacityMask> <LinearGradientBrush StartPoint="0.02,-0.082" EndPoint="0.02,0.918"> <GradientStop Color="Transparent" Offset="0"/> <GradientStop Color="#44FFFFFF" Offset="1"/> </LinearGradientBrush> </Image.OpacityMask> </Image> </Canvas> </UserControl>
using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Windows.Media.Imaging; using System.Windows.Browser; namespace Silverlight2ToolBar { public partial class box : UserControl { string _boxUrl; public string boxThumbnail { set { BitmapImage objBitmapImage = new BitmapImage(new Uri(value, UriKind.Relative)); this.Thumbnail.Source = objBitmapImage; } } public string boxThumbnail_Reflection { set { BitmapImage objBitmapImage = new BitmapImage(new Uri(value, UriKind.Relative)); this.Thumbnail_Reflection.Source = objBitmapImage; } } public string boxUrl { set { _boxUrl = value; } } public box() { InitializeComponent(); } private void boxcanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { HtmlPage.Window.Navigate(new Uri(String.Format("http://{0}",_boxUrl))); } } }