<pre><ComboBox x:Name="cbCostType" ItemsSource="{Binding}" SelectedValuePath="CostTypId" DisplayMemberPath="CostTypeName" Canvas.Left="176" Canvas.Top="118" Width="214" TabIndex="5" SelectionChanged="cbCostType_SelectionChanged"/>
<pre>public class CostType { public int CostTypeId { set; get; } public string CostTypeName { set; get; } public CostType(int costTypeId, string costTypeName) { this.CostTypeId = costTypeId; this.CostTypeName = costTypeName; } }
<pre> public static List<CostType> FillDriverCostTypeCombo() { var costList = new List<CostType>(); var costIncluded = new CostType(0, "Included"); costList.Add(costIncluded); var costMonth = new CostType(1, "Monthly"); costList.Add(costMonth); var costDay = new CostType(2, "Daily"); costList.Add(costDay); return costList; }
cbCostType.selectedValue=1;
var costTypeitem=new CostType(1,"monthly"); cbCostType.selectedItem=costTypeitem;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)