Click here to Skip to main content
15,895,815 members
Articles / Desktop Programming / WPF

WPF Country Combobox

Rate me:
Please Sign up or sign in to vote.
4.62/5 (7 votes)
16 Apr 2011CPOL2 min read 65.2K   3.7K   16  
This article will help you to create a country dropdown with the help of WPF concepts like WPF converters
  • Customcontrols.zip
    • Customcontrols
      • Customcontrols.sln
      • Customcontrols.suo
      • Customcontrols
        • App.xaml
        • App.xaml.cs
        • bin
          • Debug
            • Customcontrols.exe
            • Customcontrols.vshost.exe
            • Images
              • Countries
                • .DS_Store
                • ad.png
                • ae.png
                • af.png
                • ag.png
                • ai.png
                • al.png
                • am.png
                • an.png
                • ao.png
                • ar.png
                • as.png
                • at.png
                • au.png
                • aw.png
                • ax.png
                • az.png
                • ba.png
                • bb.png
                • bd.png
                • be.png
                • bf.png
                • bg.png
                • bh.png
                • bi.png
                • bj.png
                • bm.png
                • bn.png
                • bo.png
                • br.png
                • bs.png
                • bt.png
                • bv.png
                • bw.png
                • by.png
                • bz.png
                • ca.png
                • catalonia.png
                • cc.png
                • cd.png
                • cf.png
                • cg.png
                • ch.png
                • ci.png
                • ck.png
                • cl.png
                • cm.png
                • cn.png
                • co.png
                • cr.png
                • cs.png
                • cu.png
                • cv.png
                • cx.png
                • cy.png
                • cz.png
                • de.png
                • dj.png
                • dk.png
                • dm.png
                • do.png
                • dz.png
                • ec.png
                • ee.png
                • eg.png
                • eh.png
                • england.png
                • er.png
                • es.png
                • et.png
                • europeanunion.png
                • fam.png
                • fi.png
                • fj.png
                • fk.png
                • fm.png
                • fo.png
                • fr.png
                • ga.png
                • gb.png
                • gd.png
                • ge.png
                • gf.png
                • gh.png
                • gi.png
                • gl.png
                • gm.png
                • gn.png
                • gp.png
                • gq.png
                • gr.png
                • gs.png
                • gt.png
                • gu.png
                • gw.png
                • gy.png
                • hk.png
                • hm.png
                • hn.png
                • hr.png
                • ht.png
                • hu.png
                • id.png
                • ie.png
                • il.png
                • in.png
                • io.png
                • iq.png
                • ir.png
                • is.png
                • it.png
                • jm.png
                • jo.png
                • jp.png
                • ke.png
                • kg.png
                • kh.png
                • ki.png
                • km.png
                • kn.png
                • kp.png
                • kr.png
                • kw.png
                • ky.png
                • kz.png
                • la.png
                • lb.png
                • lc.png
                • li.png
                • lk.png
                • lr.png
                • ls.png
                • lt.png
                • lu.png
                • lv.png
                • ly.png
                • ma.png
                • mc.png
                • md.png
                • me.png
                • mg.png
                • mh.png
                • mk.png
                • ml.png
                • mm.png
                • mn.png
                • mo.png
                • mp.png
                • mq.png
                • mr.png
                • ms.png
                • mt.png
                • mu.png
                • mv.png
                • mw.png
                • mx.png
                • my.png
                • mz.png
                • na.png
                • nc.png
                • ne.png
                • nf.png
                • ng.png
                • ni.png
                • nl.png
                • no.png
                • np.png
                • nr.png
                • nu.png
                • nz.png
                • om.png
                • pa.png
                • pe.png
                • pf.png
                • pg.png
                • ph.png
                • pk.png
                • pl.png
                • pm.png
                • pn.png
                • pr.png
                • ps.png
                • pt.png
                • pw.png
                • py.png
                • qa.png
                • re.png
                • ro.png
                • rs.png
                • ru.png
                • rw.png
                • sa.png
                • sb.png
                • sc.png
                • scotland.png
                • sd.png
                • se.png
                • sg.png
                • sh.png
                • si.png
                • sj.png
                • sk.png
                • sl.png
                • sm.png
                • sn.png
                • so.png
                • sr.png
                • st.png
                • sv.png
                • sy.png
                • sz.png
                • tc.png
                • td.png
                • tf.png
                • tg.png
                • th.png
                • tj.png
                • tk.png
                • tl.png
                • tm.png
                • tn.png
                • to.png
                • tr.png
                • tt.png
                • tv.png
                • tw.png
                • tz.png
                • ua.png
                • ug.png
                • um.png
                • us.png
                • uy.png
                • uz.png
                • va.png
                • vc.png
                • ve.png
                • vg.png
                • vi.png
                • vn.png
                • vu.png
                • wales.png
                • wf.png
                • ws.png
                • ye.png
                • yt.png
                • za.png
                • zm.png
                • zw.png
            • XML
          • Release
        • Converter
        • CountryDropdown.xaml
        • CountryDropdown.xaml.cs
        • Customcontrols.csproj
        • MainWindow.xaml
        • MainWindow.xaml.cs
        • Properties
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{3794D769-73B4-4F9A-9121-1DA53D527D46}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Customcontrols</RootNamespace>
    <AssemblyName>Customcontrols</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Xaml">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
    </Reference>
    <Reference Include="WindowsBase" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>
    <Page Include="CountryDropdown.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="MainWindow.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Compile Include="App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Converter\Converter.cs" />
    <Compile Include="CountryDropdown.xaml.cs">
      <DependentUpon>CountryDropdown.xaml</DependentUpon>
    </Compile>
    <Compile Include="MainWindow.xaml.cs">
      <DependentUpon>MainWindow.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <AppDesigner Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) NeST
India India
Professional: Have 5 years experience in ASP.Net,C#.Net,MVC,WPF,,Entity Framework,WCF,LINQ,JQuery,JQuery Mobile,MS SQL,Oracle,Silverlight,MS CRM,Dynamics GP

Academics : BTech in Computer Science and Engineering from Mar Athanasius College of Engineering,Kothamangalam,Kerala .

Location : Kothamangalam, Ernakulam ,Kerala ,India
Presently working at Technopark Trivandrum,
Mob: 8281065563

Comments and Discussions