How to set the selected value to Combobox in silverlight code behind
How to set the selected value to Combobox in silverlight code behind.
Code as Follows :
<sdk:DataGridTemplateColumn Header="Risk">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<ComboBox Height="Auto"
x:Name="ComboRisk" Width="110"
ItemsSource="{Binding
Path=CusList,Mode=TwoWay}"
SelectedValuePath="{Binding Path=Risk,
Mode=OneWay}" SelectedItem="{Binding
Mode=OneWay, Path=Risk}">
<ComboBoxItem Content="High"
Background="#55A3FF"
IsEnabled="False" Margin="1,2,0,0"
/>
<ComboBoxItem Content="Test Time"
Margin="8,2,4,4" />
<ComboBoxItem Content="Yield Hit"
Margin="8,2,4,4" />
<ComboBoxItem Content="Quality
Impact (DPPM/Reli)"
Margin="8,2,4,4" />
<ComboBoxItem Content="Breaking
Download" Margin="8,2,4,4" />
<ComboBoxItem Content="ROM Update"
Margin="8,2,4,4" />
<ComboBoxItem Content="Low"
Background="#55A3FF"
Margin="1,2,0,0" IsEnabled="False"
/>
<ComboBoxItem Content="Good to go"
Margin="8,2,4,4" />
</ComboBox>
</Grid>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
in the Code Behind I am doing like this :
ComboRisk.SelectedItem = bcomstask.Risk.ToString()
No comments:
Post a Comment