InfoPath代码切换视图

Load时候切换视图

 XPathNavigator Navigator = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:field1", NamespaceManager);

            string value1 = Navigator.Value;

            if (string.IsNullOrEmpty(value1))

            {

                e.SetDefaultView("View2");

            }

            else if (value1 == "1")

            {

                e.SetDefaultView("View4");

            }



            else

            {

                e.SetDefaultView("View3");



            }

按钮或事件切换视图

 public void CTRL2_5_Clicked(object sender, ClickedEventArgs e)

        {

            // Write your code here.

            this.ViewInfos.SwitchView("View4");

        }

  

 

你可能感兴趣的:(Path)