AE xaml中定义的控件,在xaml.cs中无法用名称调用

qq_27356479 2016-04-18 11:02:47
这是页面的代码:
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Loaded="Window Loaded"
Title="MainWindow" Height="350" Width="525">
<Grid>
<my:WindowsFormsHost Margin="2" x:Name="TocControlHost" />
<my:WindowsFormsHost Grid.Column="1" x:Name="MapControlHost" Margin="308,6,299,33" >
<my:WindowsFormsHost x:Name="ToolControlHost" Margin="2" />

</Grid>
</Window>
后台代码:
AxMapControl mapControl;
AxToolbarControl toolbarControl;
AxTOCControl tocControl;
public MainWindow()
{
InitializeComponent();
CreateEngineControls();
}
private void CreateEngineControls()
{
mapControl = new AxMapControl();
this.MapControlHost.Child = mapControl;

}

this.MapControlHost.Child = mapControl; 这句提MapControlHost不存在,可是在上面的代码中我已经定义了啊,求各位帮我解答。
...全文
67 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧