What are Silverlight Input Controls?
Silverlight Input Controls:
For any UI the Input Controls and very essential and important. Lets discuss some input controls:
Button and TextBox– Buttons are simple button to submit, With the Content property you can assign the text it to check the following code:
<UserControl x:Class="myFirstSilverlightApp.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="650" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<Button x:Name="btnSubmit" Click="btnSubmit_Click"
Content="Submit" Height="30" Width="75"
HorizontalAlignment="Left"
Margin="7,5,0,0"/>
</Grid>
</UserControl>
On the other hand TextBox is very common Input controls:
<UserControl x:Class="myFirstSilverlightApp.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="650" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<TextBox x:Name="txtText" FontFamily="Arial"
Width="200" Height="20" Margin="5" Text="I am the Text Box"
HorizontalAlignment="Left" />
</Grid>
</UserControl>
Try the above code with different properties.
CheckBox and RadioButton– These are common button and an essential part of SIlverlight application’s UI part.
<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="myFirstSilverlightApp.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="650" Height="300">
<Canvas x:Name="LayoutRoot" Background="White">
<CheckBox IsChecked="True" IsThreeState="True" Content="I am Checked" Canvas.Top="25" Canvas.Left="50" />
<CheckBox IsChecked="False" IsThreeState="True" Content="Not Checked" Canvas.Top="50" Canvas.Left="50" />
<RadioButton GroupName="rb" Content="Choose" Canvas.Top="75" Canvas.Left="50" />
<RadioButton GroupName="rb" Content="Lets Choose Me" Canvas.Top="100" Canvas.Left="50" />
</Canvas>
</UserControl>
The above code described the properties of Input Controls.
Calendar – Calendar are another important Controls, these provide DateTime information.
<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="myFirstSilverlightApp.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="650" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<basics:Calendar x:Name="myCal" DisplayMode="Month"
FirstDayOfWeek="Sunday" Background="AliceBlue" />
</Grid>
</UserControl>
The Calendar control has a number of unique properties that customize the control’s behavior, including AreDatesInPastSelectable, DisplayDateEnd/Start, DisplayMode, FirstDayOfWeek,IsTodayHighlighted, and SelectableDateEnd/Start.
ListBox– Its also another very important and flexibe UI control. It is similar to the ASP.NET ListBox. This controls accepts the number of items:
<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="myFirstSilverlightApp.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="650" Height="300">
<Canvas x:Name="LayoutRoot" Background="White">
<ListBox Width="150" Height="80" Canvas.Top="50" Canvas.Left="50">
<ListBoxItem Content="Introduction" />
<ListBoxItem Content="Layout COntrols" />
<ListBoxItem Content="Input COntrols" />
<ListBoxItem Content="Defining Styles" />
<ListBoxItem Content="Global Styles" />
</ListBox>
</Canvas>
</UserControl>
Media Controls
:
Media controls contain Image and Media element controls
ListBox– It display the image from specific path. Silverlight only supports JPEG and PNG images.
<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="myFirstSilverlightApp.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="650" Height="300">
<Canvas x:Name="LayoutRoot" Background="White">
<Image x:Name="img" Source="images/myimage.png" />
</Canvas>
</UserControl>
MediaElement– It display Video and audio as image displays only static images. The MediaElement only supports Windows Media Video, Windows Media Audio, and MP3 formats.
<UserControl xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="myFirstSilverlightApp.TestControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="650" Height="300">
<Canvas x:Name="LayoutRoot" Background="White">
<MediaElement Source="WindowsMedia.wmv" AutoPlay="True" Opacity=".7">
</MediaElement>
</Canvas>
</UserControl>
Popularity: 2%
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.










Leave your response!
You must be logged in to post a comment.