为什么这段代码不起作用? :(

时间:2010-06-28 20:06:11

标签: wpf datagridview combobox

<dg:DataGrid  Name="gridList" AutoGenerateColumns="False"                 
               ItemsSource="{Binding ItemsInTable}" HeadersVisibility="Column" >
   <dg:DataGrid.RowDetailsTemplate >
      <DataTemplate x:Name="ItemDetails" >
         <Border HorizontalAlignment="Stretch" CornerRadius="5" Background="Azure" >
            <StackPanel Orientation="Vertical" Margin="0,10,0,0">
               <ComboBox Name="cboxDepartment" SelectedItem="{Binding Department}"   DisplayMemberPath="Desc" ItemsSource="{Binding DeptosInTable}" ></ComboBox>
            </StacPanel>
         </Border>
      </DataTemplate>
   </dg:DataGrid.RowDetailsTemplate>
   <dg:DataGridTextColumn Header="DEPARTMENT" Binding="{Binding Department}" Width="180" IsReadOnly="True">

部门是班级中的财产。 DeptosInTable是一个ObservableCollection,有2个属性:ID和Desc。

1 个答案:

答案 0 :(得分:2)

您犯了一个错误(我不确定它是否是唯一的错误):

        </StacPanel>

应该是:

        </StackPanel>