UpDown Control Usage

Go to properties, methods and events
Go to screenshot

for all samples
...
xmlns:DevPhone="clr-namespace:DevPhone.Controls;assembly=DevPhone.Controls.Toolkit"
...

Basic

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

Basic with LoopValues

<DevPhone:UpDownControl " Header="Sample" Increment="1" IncrementHold="10" MaxValue="100" CurrentValue="50" LoopValues="true" /> 

Basic with custom header

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

Custom Arrows

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

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

External Arrows
<DevPhone:UpDownControl Header="Sample external arrows" Increment="1" IncrementHold="10" 
        MaxValue="100" CurentValue="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
<DevPhone:UpDownControl x:Name="UpDn" Header="Sample On/Off" Increment="1" MinValue="0" MaxValue="1" CurrentValue="1" UpDownValueChanged="UpDn_UpDownValueChanged" />

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

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

Code
private void UpDn1_UpDownValueChanged(object sender, 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";
}

Last edited Jun 6, 2012 at 10:07 PM by FCerqueira, version 8

Comments

No comments yet.