Hi,I am having one problem related to ComboBox of DataGrid. Data is binding but it is not visible in the ComboBox after binding. My code is like below.
<my:DataGridTemplateColumnHeader="UsgSrc"><my:DataGridTemplateColumn.CellTemplate><DataTemplate><ComboBoxName="cbUsgSrc"ItemsSource="{Binding Source={StaticResource UsgSrcUOMS}}"SelectedValue="{Binding Path=UsgSrc}"SelectedValuePath="UtType"DisplayMemberPath="UtType"></ComboBox></DataTemplate></my:DataGridTemplateColumn.CellTemplate></my:DataGridTemplateColumn>
In the code behind I am assigning data like below.
ObjectDataProvider UsageSrcUOMS = null;
UsageSrcUOMS = (ObjectDataProvider)FindResource("UsgSrcUOMS");
UsageSrcUOMS.ObjectInstance = objUtView;
Microsoft.Windows.Controls.DataGridCell cell = obj.GetCell(dgMtrHdr, J, 11);
if (cell != null)
{
ContentPresenter panel = cell.Content as ContentPresenter;
if (panel != null)
{
ComboBox cmbUsUtilit = obj.GetVisualChild<ComboBox>(panel);
cmbUsUtilit.IsEnabled = true;
if(objUtView!=null) cmbUsUtilit.ItemsSource = objUtView;
cmbUsUtilit.SelectedIndex=2;
}
}After binding in the combo box, selected index item is selecting. But data is not visible.
Please help me to solve my problem.
cas