회사_ C#, MSSQL, WPF

C# WPF 왜 데이터가 나오는데 1분 30초가 걸릴까?

lsme 2024. 7. 10. 08:55

뭐가 문제 일까?

Binding 해서 많은 데이터들은 가져오는게 아닌가? 

 

Nop!  ItemsSource을 사용해서 Binding 해야한다. 

 

.xml 에서 ItemsSource 사용해서 해당 변수들의 상위 grid에서 binding을 추가해줘야한다. 

 

그후 .cs파일에서는 아래와 같이 사용하면 된다. 

public class Binding // 데이터 그리드 바인딩 클래스명
{
    public string Name { get; set; }

    public int Age { get; set; }
}

public ObservableCollection<Binding> BindingList { get; set; } 


public void 생성한 클래스명(){

	BindingList = new ObservableCollection<Binding>();
    
    
    //binding 담는 코드들
    
    BindingList.add();
    
    (.xml 파일에 ItemsSource={Binding BindingList} 한 곳의 x:Name 이름).ItemsSource = BindingList;
    
    
}

 

 

 

 

출처, 참고 자료 : 

https://stackoverflow.com/questions/32257785/bind-the-itemssource-of-a-datagrid-to-a-list

 

Bind the ItemsSource of a DataGrid to a List

I am trying to create a binding between a List and a DataGrid. I haven't found a working Solution in the net which is very strange. In my little example I create a List of objects with the two pu...

stackoverflow.com