나는 내가 내 주요 프로젝트 (메뉴 제어)시작 사용자 컨트롤을 동적
사용자 제어 프로젝트에 탭 컨트롤에 다른 프로젝트에서 사용자 컨트롤을로드하고자하는 사용자 정의 내장 된 메뉴 시스템을 가지고 : 는 foobar 메뉴 시스템 프로젝트 : 메뉴
탭 컨트롤에로드 할 수있는 기능 :
private void LaunchWPFApplication(string header, string pPath)
{
// Header - What loads in the tabs header portion.
// pPath - Page where to send the user
//Create a new browser tab object
BrowserTab bt = tabMain.SelectedItem as BrowserTab;
bt = new BrowserTab();
bt.txtHeader.Text = header;
bt.myParent = BrowserTabs;
//Load in the path
try
{
Type formType = Type.GetType(pPath, true);
bt.Content = (UserControl)Activator.CreateInstance(formType);
}
catch
{
MessageBox.Show("The specified user control : " + pPath + " cannot be found");
}
//Add the browser tab and then focus
BrowserTabs.Add(bt);
bt.IsSelected = true;
}
그리고 제가 예를 들어 함수에 보내
LaunchWPFApplication("Calculater", "foobar.AppCalculater");
그러나 실행될 때마다 응용 프로그램은 formType이 null이라는 오류를 표시합니다. 올바른 매개 변수를 보내는 경우 사용자 정의 컨트롤을로드하는 방법과 궁금한 점을 혼동합니다.