none
XAML应用中能不能在C++设计中动态地添加控件? RRS feed

答案

  • Hi lxylxy,

    当然可以啦~

    首先需要初始化一个WebView控件,然后给他赋予名字叫webview,设定他的长宽,接着把他放在XAML某个容器中。

    	WebView^ webviewcontrol = ref new WebView();
    	webviewcontrol->Name = "webview";
    	webviewcontrol->Height = 300;
    	webviewcontrol->Width = 400;
    	webviewcontrol->Source = ref new Uri("http://www.microsoft.com");
    	container->Children->Append(webviewcontrol);

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年4月28日 1:37
    版主