当前位置: 代码迷 >> Silverlight >> DataGridTemplateColumn没法切换模式
  详细解决方案

DataGridTemplateColumn没法切换模式

热度:3833   发布时间:2013-02-26 00:00:00.0
DataGridTemplateColumn无法切换模式
 xmlns:local="clr-namespace:WpfApplication2"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <ObjectDataProvider x:Key="Soo"   ObjectType="{x:Type local:So}">
        </ObjectDataProvider>
    </Window.Resources>
    
            <DataGrid AutoGenerateColumns="False"  Canvas.Top="0" Name="dg" Width="500" IsReadOnly="False"  BeginningEdit="dg_BeginningEdit" CellEditEnding="dg_CellEditEnding" LostFocus="dg_LostFocus">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=Name}" Header="姓名" Width="100"/>
                    <DataGridTextColumn Binding="{Binding Path=Sex}" Header="性别" Width="200"/>
                    <DataGridTemplateColumn Header="分数" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Path=Num}"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                        <DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <ComboBox x:Name="taskcob"
                                          SelectedItem="{Binding Path=Num}"
                                          ItemsSource="{Binding Source={StaticResource Soo},Mode=TwoWay}"
                                          IsEditable="True"
  相关解决方案