WPF名称中不能包含'='字符(十六进制值0x3D) [英] WPF The '=' character, hexadecimal value 0x3D, cannot be included in a name

查看:378
本文介绍了WPF名称中不能包含'='字符(十六进制值0x3D)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助,我正在尝试使用代码动态创建wpf Ojects.
当我尝试在示例中将动画添加到Button时遇到问题.这是一个自定义动画.看一下代码底部的内容:

Please help, I''m trying to create wpf Ojects dynamically using code.
I''m running into an issue when I try to add an animation, in my example to a Button. This is a custom animation. Look towards the bottom of the code where it says:

"<local:clEffects x:Name='myclEffects' x:Name='myclEffects'/>


            "<RowDefinition Height='107*'/>" &
        "</Grid.RowDefinitions>" &
        "<StackPanel Orientation='Horizontal' TextElement.FontWeight='Bold' TextElement.FontSize='72pt' Margin='2,-3,163,0' Height='177' VerticalAlignment='Top'>" &
            "<StackPanel.Resources>" &
                "<Storyboard x:Name='myStoryboard' x:Key='myFold'>" &
                    "<DoubleAnimation Storyboard.TargetProperty='clEffects.Left' Storyboard.TargetName='mysbLeft' " &
                    "/>" &
                    "</Storyboard>" &
                    "<Storyboard x:Name='myStoryboard2' x:Key='myDropShadow'>" &
                    "<DoubleAnimation Storyboard.TargetProperty='ShadowDepth' Storyboard.TargetName='mysbDropShadow'" &
                    "/>" &
                "</Storyboard>" &
            "</StackPanel.Resources>" &
            "<Button x:Name='myButton1' Content='Click!' Width='91' " &
                "Margin='60' Height='42' FontSize='24' Padding='1'>" &
                    "<Button.Effect>" &
                    "<local:clEffects x:Name='myclEffects' x:Name='myclEffects'/>" &
                    "</Button.Effect>" &
                "</Button>" &
            "</StackPanel>" &
"</Grid>"


        Dim stringReader As New StringReader(xaml)
        Dim xmlReader_1 As XmlReader = XmlReader.Create(stringReader)
        Dim tree As UIElement = DirectCast(XamlReader.Load(xmlReader_1), UIElement)
        LayoutRoot.Children.Add(tree)

End Sub



谢谢您的帮助.

代码块移至代码周围...-OriginalGriff [/edit]



Thank you for your help.

[edit]Code block move to around the code... - OriginalGriff[/edit]

推荐答案

这通常是我调试动态xaml的工作. >
Dim xmlReader_1 As XmlReader = XmlReader.Create(stringReader)处放置一个断点.
将stringReader内的文本复制到现有的xaml中,然后进行检查.

它可能有助于您找到问题的根源.
This is what I generally do to debug dynamic xaml.

Put a break point at Dim xmlReader_1 As XmlReader = XmlReader.Create(stringReader).
Copy the text inside stringReader into an existing xaml and then check it.

It may help you get to the root of the problem.


我看不到您在哪里将名称空间引用添加到本地.也许您是故意的,但后来却忘记了?
I don''t see where you''ve added the namespace reference to local. Perhaps you meant to, but then forgot?


这篇关于WPF名称中不能包含'='字符(十六进制值0x3D)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆