5 개의 항목과 5 개의 UserControl이있는 ComboBox가 있습니다.WPF UserControl 컨트롤의 적절한 처리
ComboBox Entry를 선택하면 첫 번째 UserControl을 그리드에 할당하려고합니다. 두 번째 ComboBox 항목에서 두 번째 UserControl, 세 번째 항목 ... 등등.
이제 각 UserControl에는 TextControls, ComboBoxes 및 CheckBoxes와 같은 여러 개의 컨트롤이 포함되어 있습니다.
버튼 클릭에combobox_SelectedIndexChanged()
{
if(comboBox.SelectedIndex == 1)
grid.Content = new UserControlOne();
else if(comboBox.SelectedIndex == 2)
grid.Content = new UserControlTwo();
else if(comboBox.SelectedIndex == 3)
grid.Content = new UserControlThree();
[...]
}
, 나는 할당 된 컨트롤의 값을 얻으려면,하지만 난 UserControl을 액세스하는 방법을 모른다 :
는의는 다음 의사 코드를 가정 해 봅시다.buttonSave_click()
{
//TODO: Get Values of a UserControl and assign it to the Model-Class
}
어떻게 컨트롤을 UserControl에 액세스하고 값을 가져 옵니까?
* * 아주 * 좋은 직장이었습니다.건배 – Berryl
정말 감사했습니다. 슬프게도 단순히 전체 응용 프로그램을 MVVM 패턴으로 이동할 수 없습니다. – SeToY