Pages

Thursday, March 18, 2010

Multiple selection in Silverlight ListBox

Hi All,

We can easily make any list box as enable to select multiple items in silver light.We just need to set the "SelectionMode" property of that list box below is the example for doing so.

ListBox Margin="5" x:Name="lbItems"
ItemsSource="{Binding Item, ElementName=MainPageView}"
SelectionMode="Multiple">
ListBox.ItemTemplate>
DataTemplate>
StackPanel Orientation="Horizontal" Margin="4">
TextBlock FontWeight="Bold" FontSize="12"
Foreground="#ff005588" Text="{Binding Text}">
/TextBlock>
/StackPanel>
/DataTemplate>
/ListBox.ItemTemplate>
/ListBox>



There are 3 options for the SelectionMode property that are:

Single -> Used to select only one item.

Multiple -> Used to select multiple items using Ctrl or Shift key.

Extended -> Used to select multiple items but here using Shift key you can select items range by just pressing one item, holding Shift and pressing another one.


Hope this is going to help you out... Enjoy!!!!!!


Thanks
Anil Kumar Pandey
Micorsoft MVP (C#)
Navi Mumbai,
Maharashtra

Creating a Media Player in the Silverlight

Hi All,
This is very interesting, the silver light is giving us so much power to create user friendly application. In this reason i have found that, we can create a media player using the silverlight and this is very easy. We do not need to bother about the code there is not that much code is involved, there is just a single component which we can use to create the Media player. That control is " MEDIA ELEMENT. "

Please check the following code to create the media Player. I have taken the Media element inside the Canvas and there is only 3 Buttons for PLAY, PAUSE , LOAD and STOP. Just pass the file name in the Source Property of that media element..

x:Class="VideoPlayer.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="640" d:DesignWidth="550">

x:Name="LayoutRoot" Background="White">
>
x:Name="medPlayer" Width="640" Height="480" AutoPlay="True" />
x:Name="btnPlay" Background="Green" Width="100" Height="45" Canvas.Left="8" Canvas.Top="497" Content="Play" Click="bPlay_Click" />
x:Name="btnPause" Background="Yellow" Width="100" Height="45" Canvas.Left="112" Canvas.Top="497" Content="Pause" Click="bPause_Click" />
x:Name="btnStop" Background="Red" Width="100" Height="45" Canvas.Left="216" Canvas.Top="497" Content="Stop" Click="bStop_Click" />
x:Name="btnOpen" Background="Green" Width="100" Height="45" Canvas.Left="320" Canvas.Top="497" Content="Load" Click="bOpen_Click" />
>
>
>


C# code for media Player


private void btnPlay_Click(object sender, RoutedEventArgs e)
{
medPlayer
.Play();
}

private void btnPause_Click(object sender, RoutedEventArgs e)
{
medPlayer
.Pause();
}

private void btnStop_Click(object sender, RoutedEventArgs e)
{
medPlayer
.Stop();
}

private void btnOpen_Click(object sender, RoutedEventArgs e)
{ string myUrl = "http://localhost:4065/VideoPlayer.Web/Files/Grass_loop.wmv";
Uri myUri
= new Uri(myUrl);
medPlayer
.Source = myUri;
}


Enjoy!!!!!!!!!!

Thanks
Anil Kumar Pandey
Micorsoft MVP (C#)
Navi Mumbai, Maharshtra

Friday, February 5, 2010

Become a part of UID project(Govt of Inda)

Recently I came to know about this information from our MVP group that there is a chance to be a prt of the Unique Identity Program. Here is the Details share by the MVP india lead Mr. Abhisheak Kant....



Hey



You may already be knowing that Govt. of India (GoI) is in the process of implementing the Unique Identification project for whole of India. For those who don’t know what it is, here is the link to their website: http://uidai.gov.in



The face of the project is Mr. Nandan Nilekani and the project has been regularly making public their progress (and it has been good).



The UID team has come up with a unique opportunity to tap the developer community in the country. They have invited the developer community in India to participate in developing the client software application using Java, C++ or C# for all the standard client operating systems. The developer community includes individual developer(s) or a software development company.



I have attached the official document that has the details of this project. This is one of kind chances to contribute to the nation in a geeky way!



If you or your company is interested in exploring this opportunity, you can send your intention to participate in this collaborative effort to enrolmentsw@uidai.gov.in .. if you would like to send this information to your communities, please feel free to do so.



Do let me know in case you/ your company is upto facing this HUGE challenge and are sending your expression of interest to GoI..



You can Download the Details about this in this PDF

Friday, January 29, 2010

Windows 8 is Coming Soon...

After the success of Windows 7 Microsoft is releasing its next version of operating system that is Windows 8 in July 2011. The key person from microsoft release the road map of the coming Microsoft product. Check this out...

"Windows 8" on July 1, 2011.

"Windows Server 2012" on July 2, 2012.

"Office 2012" on July 2, 2012.

"SQL Server 2011" on July 1, 2011.

"SharePoint Server 2013" on July 1, 2013.

"Exchange 2013" on July 1, 2013.

"OCS 2010" on Dec. 1, 2010.


Check this RoadMap


Enjoy!!!!

Monday, January 4, 2010

Ajax Slide Show extender Control

Hi All,
There are times when we have to include some images in our application, like in a slide shoe manner. So far displaying a slide show in our .aspx page we can use many controls just like we can use GRIDVIEW, DATA LIST or the best option is the Ajax Slide Show Extender Control. This is so simple and easy to use and we can easily disply so many images in our pages with the auto play facility and the previous and next buttons. here is the sample code to demonstrate the Ajax Slide Show Extender control..

In this code we just need to create a getSlide() method using that we can give the image path or can supply the images. The images can be stored in the application folder or in a seprate Image folder. This getSlide() is an WEB METHOD which we can create in the aspx itself..

here is the Code of the Body part of the aspx page...



body style="text-align: center">
<form id="form1" runat="server">

<h2 style="text-align: center">Slide Showh2>

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div style="text-align: center">


<script runat="Server" type="text/C#">
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
AjaxControlToolkit.
Slide[] slides = new AjaxControlToolkit.Slide[8];

slides
[0] = new AjaxControlToolkit.Slide("images/VaioX_Wallpaper.jpg", "Vaio", "Sony");
slides
[1] = new AjaxControlToolkit.Slide("images/av1.jpg", "Avtaar", "The Movie");
slides
[2] = new AjaxControlToolkit.Slide("images/Avatar Wallpapers james cameron 08.jpg", "Avtaar", "The Planes");
slides
[3] = new AjaxControlToolkit.Slide("images/chaman.jpg", "Bhains", "The Poem");
slides
[4] = new AjaxControlToolkit.Slide("images/Default_Avtaar.jpg", "Avtaar", "The Real Man");
slides
[5] = new AjaxControlToolkit.Slide("images/Dream Car.jpg", "Car", "The Dream Car");
slides
[6] = new AjaxControlToolkit.Slide("images/Dream Car1.jpg", "Car", "The Dream Car Again");
slides
[7] = new AjaxControlToolkit.Slide("images/our-story.jpg", "We the people", "The Story");
return
(slides);
}
script>

&nbsp; &nbsp;<br />
<br />

<asp:Image ID="Image1" runat="server" Height="316px" Width="388px" /><br />
<br />

<asp:Label ID="lblImageDescription" runat="server" /><br />
<br />


<asp:Button ID="Btn_Previous" runat="server" Text="Previous" />
<asp:Button ID="Btn_Next" runat="server" Text="Next" Width="64px" /><br />
<br />
<asp:Button ID="Btn_Play" runat="server" Text="Play" /><br />


<cc1:SlideShowExtender ID="SlideShowExtender1"
AutoPlay
="true" ImageDescriptionLabelID="lblImageDescription"
Loop="true" NextButtonID="Btn_Next" PlayButtonID="Btn_Play"
PlayButtonText
="Play" PreviousButtonID="Btn_Previous"
SlideShowServiceMethod
="GetSlides" StopButtonText="Stop"
TargetControlID
="Image1" runat="server">
cc1:SlideShowExtender>
div>
form>
body>



This is all we need to put in the aspx page and the slide show is ready, hope this will help you out. In case of any problem you can post your problem as comment... Waiting for your comments...........


Thanks
Anil Kumar Pandey
System Architect, MVP
Mumbai, Maharshtra

Kontera