WPF XAttribute中怎么添加事件

冏程序 2015-01-28 11:29:37
XElement dataTemplate_xOne = new XElement(ns + "DataTemplate", new XAttribute("xmlns:x", "http://schemas.microsoft.com/winfx/2006/xaml"),
new XAttribute("xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006"),
new XAttribute("xmlns:d", "http://schemas.microsoft.com/expression/blend/2008"),
new XAttribute("xmlns:local", "clr-namespace:Toshiba.XRF.PresentationLayer.Patient"),
new XElement(ns + "WrapPanel",
new XElement(ns + "CheckBox", new XAttribute("Name", "Check1"), new XAttribute("Tag", "{Binding CheckBox_Tag}"),
new XAttribute("HorizontalContentAlignment", "Center"), new XAttribute("Command", "local:RowDetail_Command.CheckValue"),
new XAttribute("Margin", "0,10,0,0"),
new XAttribute("VerticalContentAlignment", "Center")),
new XElement(ns + "TextBlock", new XAttribute("Name", "Text1"),
new XAttribute("TextWrapping", "Wrap"), new XAttribute("Text", "{Binding " + DataName + "}"),
new XAttribute("Padding", "5"))),
new XElement(ns + "DataTemplate.Triggers", new XElement(ns + "DataTrigger", new XAttribute("Binding", "{Binding ElementName=Text1,Path=Text}"), new XAttribute("Value", "Completed"),
new XElement(ns + "Setter", new XAttribute("TargetName", "Check1"), new XAttribute("Property", "IsEnabled"), new XAttribute("Value", "False")),
new XElement(ns + "Setter", new XAttribute("TargetName", "Check1"), new XAttribute("Property", "IsChecked"), new XAttribute("Value", "True")),
new XElement(ns + "Setter", new XAttribute("TargetName", "Text1"), new XAttribute("Property", "Foreground"), new XAttribute("Value", "Red")))));
这个里面引用的命名空间为什么会报错?而且那个怎么给checkbox添加checked事件?
希望那个高手帮帮忙........
...全文
199 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
exception92 2015-01-28
  • 打赏
  • 举报
回复
你这类似xml文件 没法添加事件

8,735

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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