请问为什么usercontrol中的控件不能保存名称? canvas1改另外个名字,可能你有控件命名这个了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <UserControl x:Class="WpfControlLibrary1.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="40" Width="100" FlowDirection="LeftToRight" Canvas.Left="0" Canvas.Top="0" Background="White"> <Canvas Height="105" Name="canvas1" Width="111" HorizontalAlignment="Left" VerticalAlignment="Top"> <Image Canvas.Left="25" Canvas.Top="40" Height="50" Name="image1" Stretch="Fill" Width="50" Margin="0" /> <TextBox Canvas.Left="0" Canvas.Top="0" Height="40" Name="textBox1" Width="100" IsReadOnly="True" Cursor="Hand" IsEnabled="True" Focusable="False">hihi</TextBox> </Canvas></UserControl> Name="canvas1" Name="image1"Name="textBox1" 这个自定义控件中含有上面三个小控件,这些小控件都不能有名字,不然执行下列语句时候报错Object obj = XamlReader.Load(ms);报错:无法在元素“Canvas”上设置名称属性值“canvas1”。“Canvas”在元素“UserControl1”的范围内,在另一范围定义它时已注册名称。 行“3”位置“13”。 C#图片的拖动及缩放 TreeList绑定问题. 问一个正则表达式问题,替换table标签 一个使用DataAdapter更新带有自动编号字段的Access表的问题 如何判断同时按下两个方向键? 我在用VS2003时经常会出现这问题: 事件属性 错误应用程序svchost.exe版本5.2.3790.0 错误模 块svchost.exe 错误地址ox00001cd7 排版算法的问题 excell转为text文件出现问题,请教了 求助!使用DATASET输出到XSL后的分页 困惑……………… c# 中执行dos命令 这是神马情况
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="40" Width="100" FlowDirection="LeftToRight" Canvas.Left="0" Canvas.Top="0" Background="White">
<Canvas Height="105" Name="canvas1" Width="111" HorizontalAlignment="Left" VerticalAlignment="Top">
<Image Canvas.Left="25" Canvas.Top="40" Height="50" Name="image1" Stretch="Fill" Width="50" Margin="0" />
<TextBox Canvas.Left="0" Canvas.Top="0" Height="40" Name="textBox1" Width="100" IsReadOnly="True" Cursor="Hand" IsEnabled="True" Focusable="False">hihi</TextBox>
</Canvas>
</UserControl>
Name="image1"
Name="textBox1"
这个自定义控件中含有上面三个小控件,这些小控件都不能有名字,不然执行下列语句时候报错
Object obj = XamlReader.Load(ms);
报错:无法在元素“Canvas”上设置名称属性值“canvas1”。“Canvas”在元素“UserControl1”的范围内,在另一范围定义它时已注册名称。 行“3”位置“13”。