In WPF Multicolumn ComboBox we can easily complete it By the following procedure:
Modify your Combobox maml as following:
================XAML Binding ===============
==========Your UI Code for Load ComboBox:=========
=============== Business Logic============
============== GateWay:=============
Enjoy....
Modify your Combobox maml as following:
================XAML Binding ===============
<ComboBox Height="23" HorizontalAlignment="Left" Margin="87,7,0,0" Name="ZoneBranchIDcomboBox" VerticalAlignment="Top" Width="160" >
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ZoneBranchId}" Width="60"/>
<TextBlock Text="|"/>
<TextBlock Text="{Binding ZoneBranchName}" Width="60"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
private void LoadBranchIDComboBox()
{
ZoneBranchIDcomboBox.Items.Clear();
listOfZone = ObjBZoneSetup.GetAllBranchID();
foreach (EZoneSetup floorSetupObj in listOfZone)
{
ZoneBranchIDcomboBox.ItemsSource = listOfZone;
}
}
=============== Business Logic============
public List GetAllBranchID()
{
List listOfZoneBranchID = ObjZoneDAL.GetAllBranchID();
return listOfZoneBranchID;
}
public List GetAllBranchID()
{
List listOfBranchID = new List();
try
{
foreach (var ZoneSetup in objDataContext.SP_GET_BRANCH_NAME())
{
EZoneSetup eZoneSetupobj = new EZoneSetup();
eZoneSetupobj.ZoneBranchId = ZoneSetup.WI_ID;
eZoneSetupobj.ZoneBranchName = ZoneSetup.WI_NAME;
listOfBranchID.Add(eZoneSetupobj);
}
}
catch (Exception exception)
{
throw exception;
}
return listOfBranchID;
}
Enjoy....
Comments
Post a Comment