Action Controls


The RadioButton control provides the user with a set of choices. Unlike the ComboBox control, which displays only a selected option, a set of RadioButton controls commonly present all available options on the screen at the same time. Basic XAML required to add a RadioButton to your user interface is as follows.

<RadioButton Content="first" IsChecked="True"/>

Like other XAML controls, the Content property determines what text should displayed to the user along with the actual RadioButton control. The RadioButton also offers an IsChecked property to set up the default selection state. Although it is perfectly effective to show only a single selection with a RadioButton, the control is useful when you add a group of them to the screen. The RadioButton is to provide a list of options to the user but allow only for one valid selection at a time. When the user selects another RadioButton control, whatever RadioButton is currently selected should become deselected. This is all due to use of the GroupName property. In the following XAML code, three RadioButton controls are added to the user interface, and by setting the GroupName property to the same value, only one choice is allowed across all three RadioButton controls.

<RadioButton Content="First" GroupName="RadioOptions" IsChecked="True"/>
<RadioButton Content="Second" GroupName="RadioOptions"/>
 <RadioButton Content="Third" GroupName="RadioOptions"/>


The Slider control is a valuable control in your user interface when any one wants to increment/decrement a particular value. While declaring a Slider control, you have to set the Minimum and Maximum properties to values that make sense for your scenario. Default, these values are set to 0 and 100, respectively. The following XAML code shows a basic Slider control that uses a range of 0 to 100.

<Slider x: Name="MySlider" Minimum="0" Maximum="100" />

The event handler for the ValueChanged event for this slider is as follows.

Private void MySlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
SliderValue.Text = String.Format("Slider Value: {0}", (int)MySlider.Value);


The Image control is used to display images in your app. The images used by the Image control can reside internally in your application or can also display from external resources. The Source property is used to determine what to display. The following XAML code displays an image with in your app without stretch:

<Image Source="Images/selfi.png" Stretch="None"/>

The Source property in this case searches for a file called selfi.png in the Images folder of your project. The Stretch property deals with several possible values including None, Fill, Uniform, and UniformToFill. If you want to display the image at its default size, you simply use the Stretch option as None. If you have a larger container and you want to fit the image to the whole container  you can set the Stretch property to one of the alternative fil options, and the image will stretch to fil the remaining space in the container. 
Action Controls Action Controls Reviewed by Afsar Murad on 09:47 Rating: 5
Powered by Blogger.