This project is read-only.

Installation

  • Download later version install msi
  • Execute setup install.
  • Add reference UpDownPhone.dll in your project or include in VS2010 toolbox. Default folder from setup is "ProgramFilesFolder\Microsoft SDKs\Windows Phone\v7.1\UpDownPhone"
  • Enjoy

Properties / Events

Usage

for all samples
...
xmlns:my="clr-namespace:UpDownPhone;assembly=UpDownPhone"
...

Basic

<my:UpDownControl " Header="Sample" Increment="1" IncrementHold="10" MaxValue="100" Value="50" /> 

Basic with custom header

<my:UpDownControl Increment="1" IncrementHold="10" MaxValue="100" Value="50">
    <my:UpDownControl.HeaderTemplate>
        <DataTemplate>
             <TextBlock Text="Custom Header" 
                        Foreground="#99FF6407"
                        FontWeight="Bold" 
                        FontSize="32" />
        </DataTemplate>
    </my:UpDownControl.HeaderTemplate>
</my:UpDownControl>

Custom Arrows

Up/Down direction
<my:UpDownControl Header="Sample up/down direction" Increment="1" IncrementHold="10" MaxValue="100" Value="50" ArrowDirection="UpDown" GapArrow="10" />

Arrows color
<my:UpDownControl Header="Sample custom color" Increment="1" IncrementHold="10" MaxValue="100" Value="50" ArrowDisabledColor="#663EB4A0" >
    <my:UpDownControl.ArrowColor>
        <RadialGradientBrush>
            <GradientStop Color="White" Offset="0" />
            <GradientStop Color="#FF42C71A" Offset="1" />
        </RadialGradientBrush>
    </my:UpDownControl.ArrowColor>
</my:UpDownControl>

External Arrows
<my:UpDownControl Header="Sample external arrows" Increment="1" IncrementHold="10" 
        MaxValue="100" Value="50" ArrowDirection="External" GapArrow="30" 
        ExternalPathLeft="M 15,0 L 0,15 L 15,30 L 10,15 Z"
        ExternalPathRight="M 15,0 L 30,15 L 15,30 L 20, 15 Z" />

Custom Values

On/Off
<my:UpDownControl x:Name="UpDn" Header="Sample On/Off" Increment="1" MinValue="0" MaxValue="1" Value="1" UpDownValueChanged="UpDn_UpDownValueChanged" />

Code
private void UpDn_UpDownValueChanged(object sender, UpDownPhone.UpDownCustomValueChangedEvent e)
{
    if (e.NewValue.Equals(1))
    {
        e.CustomValue = "On";
    }
    else
    {
        e.CustomValue = "Off";
    }
}

Custom Ranger
<my:UpDownControl x:Name="UpDn" Header="Sample value less than 10 = off and skip 10 to 10" Increment="10" IncrementHold="10" IncrementHoldStart="0" MaxValue="100" Value="50" UpDownValueChanged="UpDn1_UpDownValueChanged" SpeedHold="100" />

Code
private void UpDn1_UpDownValueChanged(object sender, UpDownPhone.UpDownCustomValueChangedEvent e)
{
    if (e.OldValue.Equals(0))
    {
        e.CustomText = " level";
        e.NewValue = 10;
        e.CustomValue = "10";
        return;
    } 
    if (e.NewValue < 10)
    {
        e.CustomValue = "Off";
        e.NewValue = 0;
        e.CustomText = string.Empty;
        return;
    }

    e.CustomValue = e.NewValue.ToString(CultureInfo.InvariantCulture);
    e.CustomText = " level";
}

Nuget Install

Nuget.png
Nuget will not install UpDownPhone.design.dll. This dll is required to display the control toolbox in visual studio 2010 correctly.If you want to maintain control in the toolbox, use the recommended installation (msi install)

Last edited May 8, 2012 at 4:02 PM by FCerqueira, version 12

Comments

No comments yet.