首页 新闻 会员 周边

WPF 控件重写Template

0
悬赏园豆:5 [已关闭问题] 关闭于 2014-09-23 10:12

如:

  在

<ScrollViewer x:Class="Com.Leeone.Ebag.Teacher.Resources.UseControl.UserScrollViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Initialized="PART_ContentHost_Initialized"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<ScrollViewer.Template>
<ControlTemplate TargetType="{x:Type ScrollViewer}">

</ControlTemplate>
</ScrollViewer.Template>

</ScrollViewer>

重写后用这个自定义滚动条,在它下面的子控件不能对 x:Name赋值,

一赋值就报错“

    <myControl:CustomScrollViewer>
                    <ListView    Name="lvFiles" >
            </ListView    >

   </myControl:CustomScrollViewer>

 

无法对元素“ListView”设置 Name 特性值“lvFiles”。“ListView”在元素“CustomScrollViewer”的范围内,在另一范围内定义它时,已注册了名称。 

metoer的主页 metoer | 初学一级 | 园豆:8
提问于:2014-08-22 15:40
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册