Border Control In Universal Apps

Border is a control that draws border, background or both around another control. It Is a container control such as Grid but you can declare only 1 child element inside it. You must add another container control like Grid or StackPanel to add more controls inside.
 
Border control looks like the following:

Blank Squire
Here's how we declare it inside XAML:
  1. <Border BorderBrush="Black" BorderThickness="1" Height="203" Width="343">  
  2.    //Container Controls or a child control can be declared here  
  3. </Border>   
Let's make another example on how to declare it. 

Here's an example how to use single child control in a Border Control:
  1. <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="203" 
  2.         Margin="136,103,0,0" VerticalAlignment="Top" Width="343">  
  3.      <CheckBox Content="Tick me!"  />         
  4. </Border>  

Here's another example how to use StackPanel to contain many child controls inside a Border Control:
  1. <Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="203" 
  2.         Margin="136,103,0,0" VerticalAlignment="Top" Width="343">  
  3.   <StackPanel>  
  4.       <CheckBox Content="Tick Me"/>  
  5.       <CheckBox Content="Tick Me Too"/>  
  6.       <CheckBox Content="Tick Me Last"/>  
  7.   </StackPanel>    
  8. </Border>  

Border control is useful if you are going to contain or group controls inside a visually bordered control.  


Similar Articles