Quantcast
Viewing all articles
Browse latest Browse all 5308

Data Binding In Windows 8. Part 3–Element Binding

In my previous post, I discussed the three modes of DataBinding for Windows 8. Today Image may be NSFW.
Clik here to view.
CheckBox
we’ll take a brief look at binding not to data, but rather binding one UI element to the value of another.  In this example, we’ll bind the IsActive property of the ProgressRing to the IsChecked property’s value in a CheckBox. 

<StackPanel>
     <StackPanel
         Orientation="Horizontal"
         HorizontalAlignment="Left"
         >
         <TextBlock
             Text="ProgressRing:"
             VerticalAlignment="Center"
             Margin="0,0,20,0" />
         <Border
             BorderThickness="1"
             BorderBrush="#44000000"
             Padding="10">
             <ProgressRing
                 x:Name="ProgressRing1"
                 IsActive="{Binding IsChecked, 
                    ElementName=ActiveCB}" />
         </Border>
     </StackPanel>
     <CheckBox
         Name="ActiveCB"
         Content="Active?" />
 </StackPanel>

Notice that the IsActive property is bound to the IsChecked property and the ElementName (ActiveCB) is the Name of the CheckBox with that property. 

That’s it, there is no code associated with this example; just the XAML.

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 5308

Trending Articles