In this article, you will find a demo of a VB.NET way to duplicate the spinning panel effect widely used on the iPhone to let a panel host content both on its front and its back.
|
<UserControl x:Class="Bornander.UI.Test.Stocks.SymbolView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="128" d:DesignWidth="420">
<UserControl.Resources>
<LinearGradientBrush x:Key="overviewBackground" StartPoint="0.5, 0" EndPoint="0.5, 1">
<GradientStop Color="#F0F0FF" Offset="0"/>
<GradientStop Color="#0000A0" Offset="0.2"/>
<GradientStop Color="#0000A0" Offset="0.5"/>
<GradientStop Color="#0000A0" Offset="0.8"/>
<GradientStop Color="#000040" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="changeBetterBackground" StartPoint="0.5, 0" EndPoint="0.5, 1">
<GradientStop Color="#F0FFF0" Offset="0"/>
<GradientStop Color="#00A000" Offset="0.25"/>
<GradientStop Color="#00A000" Offset="0.5"/>
<GradientStop Color="#00A000" Offset="0.75"/>
<GradientStop Color="#004000" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="changeWorseBackground" StartPoint="0.5, 0" EndPoint="0.5, 1">
<GradientStop Color="#FFF0F0" Offset="0"/>
<GradientStop Color="#A00000" Offset="0.25"/>
<GradientStop Color="#A00000" Offset="0.5"/>
<GradientStop Color="#A00000" Offset="0.75"/>
<GradientStop Color="#400000" Offset="1"/>
</LinearGradientBrush>
<Style TargetType="Label" x:Key="symbolOverview">
<Style.Setters>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style.Setters>
</Style>
<Style TargetType="Label" x:Key="symbolDetails">
<Style.Setters>
<Setter Property="Foreground" Value="LightBlue"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style.Setters>
</Style>
<Style TargetType="Label" x:Key="symbolChange">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsBetter}" Value="True">
<Setter Property="Background" Value="{StaticResource ResourceKey=changeBetterBackground}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsBetter}" Value="False">
<Setter Property="Background" Value="{StaticResource ResourceKey=changeWorseBackground}"/>
</DataTrigger>
</Style.Triggers>
<Style.Setters>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Right"/>
</Style.Setters>
</Style>
</UserControl.Resources>
<Border BorderBrush="Black" BorderThickness="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.70*"/>
<ColumnDefinition Width="0.30*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="White" BorderThickness="0,0,1,0">
<Grid Background="{StaticResource ResourceKey=overviewBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".3*"/>
<ColumnDefinition Width=".45*"/>
<ColumnDefinition Width=".25*"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{Binding Path=Name, Mode=OneWay}" HorizontalContentAlignment="Left" Style="{StaticResource ResourceKey=symbolOverview}"/>
<Label Grid.Row="0" Grid.Column="1" Content="{Binding Path=Price, Mode=OneWay, Converter={StaticResource ResourceKey=doubleToAmount}}" HorizontalContentAlignment="Right" Style="{StaticResource ResourceKey=symbolOverview}"/>
<Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=AbsoluteChange, Mode=OneWay, Converter={StaticResource ResourceKey=doubleToAmount}}" HorizontalContentAlignment="Right" Style="{StaticResource ResourceKey=symbolOverview}"/>
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Content="{Binding Path=FullName, Mode=OneWay}" Style="{StaticResource ResourceKey=symbolDetails}"/>
</Grid>
</Border>
<Label Grid.Row="0" Grid.Column="1" Content="{Binding Path=RelativeChange, Mode=OneWay, Converter={StaticResource ResourceKey=doubleToSignedPercentage}}" Style="{StaticResource ResourceKey=symbolChange}"/>
</Grid>
</Border>
</UserControl>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Article videos
Oakmead Apps Android Games
21 Feb 2014: Best VB.NET Article of January 2014 - Second Prize
18 Oct 2013: Best VB.NET article of September 2013
23 Jun 2012: Best C++ article of May 2012
20 Apr 2012: Best VB.NET article of March 2012
22 Feb 2010: Best overall article of January 2010
22 Feb 2010: Best C# article of January 2010