2012-09-13 2 views

답변

3

XAML

<Button Command="{Binding ButtonCommand}">Button</Button> 
    <DataGrid ItemsSource="{Binding MyCollection}"> 
    ... 
    configure columns to MyRowViewModel 
    ... 
    </DataGrid> 

뷰 모델

public class MyViewModel 
    { 
    public ICommand ButtonCommand {get;set;} 
    public ObservableCollection<MyRowViewModel> MyCollection {get;set;} 
    } 

과의 OnLoad 설정 :

View.DataContext = viewModel; 

및 명령은 수집 또는 자동으로

을 그리드를 작성하고 WPF 업데이트 변화를 호출 할 때
+0

감사 너는 ... – Revathi