开发者

Silverlight Combobox Issue

I am trying to use a combobox inside a datagrid, but I am running into an issue. Here is the code:

<sdk:DataGrid AutoGenerateColumns="False" Margin="6,71,6,0"  Name="dgridDeptNums" Loaded="dgridDeptNums_Loaded" Height="226" VerticalAlignment="Top">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTemplateColumn Header="Speciality" Width="*">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <ComboBox SelectedValue="{Binding Department, Mode=TwoWay}">
                                <ComboBox.Items>
                                    <ComboBoxItem>Information Technology</ComboBoxItem>
                                    <ComboBoxItem>Human Resources</ComboBoxItem>
                                    <C开发者_如何学JAVAomboBoxItem>Engineering</ComboBoxItem>
                                 etc...
                                </ComboBox.Items> 
                            </ComboBox>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTextColumn Header="# of Supervisors" Binding="{Binding Providers, Mode=TwoWay}" Width="*"/>
                <sdk:DataGridTextColumn Header="# of Managers" Binding="{Binding Midlevels, Mode=TwoWay}" Width="*"/>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

The issue is that I want to databind the department, but all I get is System.Windows.Controls.ComboBoxItem. I am sure I am missing something here, so any help is appreciated.

Wade


instead of <ComboBoxItem>Information Technology</ComboBoxItem>

use <sys:string>Information Technology</sys:string>

where

xmlns:sys="clr-namespace:System;assembly=mscorlib"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜