Blue Theme Orange Theme Green Theme Red Theme
 
Home | Forums | ASP.NET 2.0 Tutorials | Web Services | How Do I...? | Class Browser | WPF Quick Starts | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Team Foundation Server Hosting
Search :       Advanced Search »
Home » .NET 3.0 » ComboBox in XAML

ComboBox in XAML

ComboBox is the most useable control in programming. In .NET 3.0 it is different from all previous version of .NET.

Author Rank :
Page Views : 21465
Downloads : 46
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
XAMLComboBox.zip
 
 
Nevron Gauge for SharePoint
Become a Sponsor
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

The element represents a ComboBox in XAML. A ComboBox is a collection of ComboBoxItems represented by element in XAML. Here in this article I am going to show that how we can create ComboBox and how we can add item in the ComboBox.  By default, the ComboBox height and width is full screen. In a ComboBox we can use CheckBox item, Images etc.

The following window1.Xaml code is showing that how we can create the ComboBox and add item in that ComboBox.

<Window x:Class="XAMLComboBox.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="XAMLComboBox" Height="300" Width="300"

    >

  <!--Here in ComboBox we find a property IsEditable if we set it as True the we can write anything inside the ComboBox-->

  <!--By Default the height and width of ComboBox is same as OPage Size So here we can set the height and width Property -->

  <ComboBox IsEditable="False" Width="150" Height="150">

    <!--From here I am adding the Item in ComboBox-->

    <ComboBoxItem FontSize="15">India</ComboBoxItem>

    <ComboBoxItem >USA</ComboBoxItem>

    <ComboBoxItem FontSize="15">England</ComboBoxItem>

    <ComboBoxItem FontSize="15">Switzerland</ComboBoxItem>

    <ComboBoxItem FontSize="15"></ComboBoxItem>    

  </ComboBox>

</Window>

The window will become look like as:



Figure 1.

We can also add images in a ComboBox. We can do it by using a ComboBox property. This window1.Xaml code is showing that how we can add images in a ComBox.

<Window x:Class="XAMLComboBox.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="XAMLComboBox" Height="300" Width="300"

    >

    <!--To add Images in ComboBox-->

    <!--Here in Image element we have to set height and Width property Otherwise Image will show in actual Size-->
    <ComboBox IsEditable="False" Width="150" Height="150">

    <Image Name="Image1" Source="1.jpg" Height="100" Width="100"/>

    <Image Name="Image2" Source="2.jpg" Height="100" Width="100"/>

    <Image Name="Image3" Source="3.jpg" Height="100" Width="100"/>

    <Image Name="Image4" Source="4.jpg" Height="100" Width="100"/>    

  </ComboBox>

</Window>

The window will become look like as:



Figure 2.

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Rahul Kumar Saxena
Rahul shows great interests in working with Microsoft technologies. He specializes in the implementation of DataBase & Graphics. His area of expertise includes: C#, ASP.NET,ADO.NET,Windows Forms & Web Services. He hails from background , Master's in Computer Application. With programming he loves photography, traveling and reading books.
(Talabpur*)
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
 Comments
Good Job... But I by Subha Ranjan On July 3, 2007
Hi.. you have done good job.. but i want to do same ...cambo with iamges in asp.net pages... then how can i ? pls help me. again thanks for your article... Subha
Reply | Email | Modify 
Thanks.. Can You Help.. by Subha Ranjan On July 3, 2007
Hi.. good goj... Thanka for your article... can you help me how to implement same combo with image in ASP.Net page using c#.... my ID is srsahoo@gmail.com Thanks again..... Subha Ranjan
Reply | Email | Modify 
Re: Thanks.. Can You Help.. by Rahul Kumar On July 4, 2007

Hi Subha,

h r u dear.

I will surely help u.

If u have any prob then u can contact me here my Email ID.

Thanx
RAhul Saxena
14rahulsaxena@gmail.com

Reply | Email | Modify 

 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.