글
<StackPanel>
<!--데이터바인딩-->
<!--스크롤바가 움직일때 마다 위치를 label에 넣기-->
<!--ValueChanged에 이벤트를 걸고 C#에서 처리-->
<Label Name="label1" HorizontalAlignment="Center"/>
<ScrollBar Name="scroll1" Orientation="Horizontal" Margin="20" Minimum="1" Maximum="100"
LargeChange="10" SmallChange="1" ValueChanged="scroll1_ValueChanged"/>
<!--데이터바인딩 이용-->
<Label Name="label2" HorizontalAlignment="Center" Content="{Binding ElementName = scroll2, Path = Value}"/>
<Button FontSize="{Binding ElementName = scroll2, Path = Value}">버튼</Button>
<ScrollBar Name="scroll2" Orientation="Horizontal" Margin="20" Minimum="1" Maximum="100"
LargeChange="10" SmallChange="1" />
<TextBox Name="txt1"/>
<TextBox Name="txt2" Text="{Binding ElementName=txt1, Path=Text}"/>
<!--바인딩되어 txt2는 txt1에 종속적이 되버림-->
</StackPanel>
============================================================================
이벤트
private void scroll1_ValueChanged(object sender,
RoutedPropertyChangedEventArgs<double> e)
{
label1.Content = scroll1.Value;
}
RECENT COMMENT