Help us understand the problem. What is going on with this article?

Visual Studio / WPF > コントロール > Slider > SmallChange, LargeChangeプロパティ

More than 3 years have passed since last update.
動作環境
Windows 7 Pro (32bit)
Microsoft Visual Studio 2017 Community
Sublime Text 2

@ WPF 4.5入門 by 大田一希さん
No.4550 / 9985

4.6.5.2 値の増減幅の設定

SmallChange, LargeChangeというプロパティを使うようだ。
使ってみた。

XAML
<Window x:Class="_170426_t0930_radioButton.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:_170426_t0930_radioButton"
        mc:Ignorable="d"
        Title="MainWindow" Height="400" Width="525">
    <Grid Margin="0,30,0,0">
        <StackPanel>
            <Slider x:Name="slider1" Margin="0, 10" 
                    Maximum="100"
                    SmallChange="5" LargeChange="20"
                    ValueChanged="slider1_ValueChanged"/>
            <Slider x:Name="slider2" Margin="0, 10"
                    Maximum="200"
                    />
            <Slider x:Name="slider3" Margin="0, 10"
                    Maximum="400"
                    />
            <Button Content="Turtle" Margin="0, 5" Click="Button_Click"/>
            <Button Content="Rabbit" Margin="0, 5" Click="Button_Click_1"/>
        </StackPanel>
    </Grid>
</Window>
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _170426_t0930_radioButton
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            slider2.Value = slider1.Value;
            slider3.Value = slider1.Value;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            slider1.Value += slider1.SmallChange;
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            slider1.Value += slider1.LargeChange;
        }
    }
}

ボタンによりSlider1の値をLargeChange, SmallChangeの値で変更する。
Turtle(小さい)、Rabbit(大きい)増加。

こういう使い方が正しいかは不明。

work.png

7of9
セブンオブナインです。Unimatrix 01の第三付属物 9の7という識別番号です。Star trek Voyagerの好きなキャラクターです。まとめ記事は後日タイトルから内容がわからなくなるため、title検索で見つかるよう個々の記事にしてます。いわゆるBorg集合体の有名なセリフから「お前たち(の知識)を吸収する。抵抗は無意味だ」。Thanks in advance.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away