Wednesday 27 May 2015

Element Binding in Xaml

XAML element binding allows binding of different elements through properties which means providing value to particular element from another element's value.
Following code describes this process in which font size of text block is bound to value property of slider element.

1  >Open Visual Studio
2  >Start new project
3 >Select windows phone app And choose blank page
4 >Open MainPage.xaml from solution explorer 
Now copy and past following code.


<Grid>
        <Slider Minimum="40" Maximum="100" Name="slider1"></Slider>
       <TextBlock FontSize="{Binding Value, ElementName=slider1}" Text="simple text"></TextBlock>
    

</Grid>

The above code shows that the value of font size will be increased as the slider moves.


No comments:

Post a Comment