2012-07-12 2 views
0

데이터 집합이 데이터 집합으로 묶인 경우 해당 데이터 집합을 보유하는 속성은 무엇입니까?DataGrid에서 데이터 집합 채우기

만약 그렇다면; 그런 다음 DataGrid의 데이터 집합을 반환 할 수 있습니까?

DataGrid에서 데이터 집합을 반환하는 속성이 있다고 생각하지 않습니까?

답변

1

당신과 XAML에서 데이터 그리드가있는 경우 :

<Grid> 
     <DataGrid AutoGenerateColumns="True" Height="200" HorizontalAlignment="Left" Margin="41,32,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="200" /> 
    </Grid> 

을하고 같은 데이터 그리드에 데이터 세트를 할당됩니다

DataTable dt = ((DataView)dataGrid1.ItemsSource).ToTable(); 
DataSet dsNew = new DataSet(); 
dsNew.Tables.Add(dt); 
: 다음

dataGrid1.ItemsSource = ds.Tables[0].AsDataView(); 

다음을 수행 할 수 있습니다

dsNew은 DataGrid에서 테이블을 보유합니다.

관련 문제