Wednesday, March 23, 2011

WPF Multicolumn ComboBox

In WPF Multicolumn ComboBox we can easily complete it By the following procedure:
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>  

==========Your UI Code for Load 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;  
 }  

============== GateWay:=============
 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....

SQL Get all Index create script from Database

To get all script from database as a create new index into another database you can use the following --Get all Index Script SELECT...