WPF learning path (12) control (Range control), wpfrange

Source: Internet
Author: User

WPF learning path (12) control (Range control), wpfrange

 

ProgressBar

Progress bar. The main attribute is Minimum \ Maximun \ Value. If IsIndeterminate is True, the progress bar runs cyclically.

<Grid>    <Grid.RowDefinitions>        <RowDefinition />        <RowDefinition />    </Grid.RowDefinitions>    <StackPanel Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center">        <ProgressBar Name="pb1" Height="20" Width="200" Foreground="LightBlue" IsIndeterminate="True"></ProgressBar>    </StackPanel>    <StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">        <ProgressBar Name="pb2" Height="20" Width="200" Foreground="LightBlue"></ProgressBar>        <Button Name="btn" MaxWidth="50" Margin="5" Click="BTN_Click">Start</Button>    </StackPanel></Grid>
private void BTN_Click(object sender, RoutedEventArgs e){    Duration duration = new Duration(TimeSpan.FromSeconds(10));    DoubleAnimation doubleAnimation = new DoubleAnimation(100, duration);    pb2.BeginAnimation(ProgressBar.ValueProperty, doubleAnimation);}

 

 

More

Http://www.codeproject.com/Articles/38555/WPF-ProgressBar

Http://blog.csdn.net/tcjiaan/article/details/6963687

 

 

Silder

A very common slider. The widget displays a series of scale values and a slider that can be dragged. You can drag the slider to control the value of the widget.

<Grid>    <Grid.ColumnDefinitions>        <ColumnDefinition />        <ColumnDefinition />    </Grid.ColumnDefinitions>    <Rectangle Grid.Column="0" x:Name="rect" Fill="Black"></Rectangle>    <StackPanel Grid.Column="1">        <StackPanel Orientation="Horizontal" Margin="10,2,5,2" >            <TextBlock Text="R" Margin="5,1,1,1" VerticalAlignment="Center"></TextBlock>            <Slider Name="RSlider" Margin="5" Minimum="0" Maximum="255" TickFrequency="10" Ticks="0,50,100,150,200,250"                    TickPlacement="BottomRight" IsSnapToTickEnabled="False" ValueChanged="RSlider_ValueChanged" MinWidth="220"></Slider>        </StackPanel>        <StackPanel Orientation="Horizontal" Margin="10,2,5,2" >            <TextBlock Text="G" Margin="5,1,1,1" VerticalAlignment="Center"></TextBlock>            <Slider Name="GSlider" Margin="5" Minimum="0" Maximum="255" TickFrequency="10" Ticks="0,50,100,150,200,250"                    TickPlacement="BottomRight" IsSnapToTickEnabled="False" ValueChanged="GSlider_ValueChanged" MinWidth="220"></Slider>        </StackPanel>        <StackPanel Orientation="Horizontal" Margin="10,2,5,2" >            <TextBlock Text="B" Margin="5,1,1,1" VerticalAlignment="Center"></TextBlock>            <Slider Name="BSlider" Margin="5" Minimum="0" Maximum="255" TickFrequency="10" Ticks="0,50,100,150,200,250"                    TickPlacement="BottomRight" IsSnapToTickEnabled="False" ValueChanged="BSlider_ValueChanged" MinWidth="220"></Slider>        </StackPanel>    </StackPanel></Grid>
private void RSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)        {            Update();        }        private void BSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)        {            Update();        }        private void GSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)        {            Update();        }        private void Update()        {            Color color = Color.FromRgb(Convert.ToByte(RSlider.Value), Convert.ToByte(BSlider.Value), Convert.ToByte(GSlider.Value));            rect.Fill = new SolidColorBrush(color);        }

 

More

Http://blog.csdn.net/tcjiaan/article/details/6997900

 

 

 

 

 

 

To be continue...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.