Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Set DataContext for StackPanel

<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             DataContext="{Binding ElementName=scroll}">     <ScrollBar Name="scroll"                Orientation="Horizontal" Margin="24"                 Minimum="1" Maximum="100" LargeChange="10" SmallChange="1" />     <Label HorizontalAlignment="Center"            Content="{Binding Path=Value, Mode=OneWay}" />     <Button HorizontalAlignment="Center" Margin="24"             FontSize="{Binding Path=Value, Mode=OneWay}">         Bound Button     </Button> </StackPanel>