本文介绍了如何为项目控件内的项目添加单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在为item控件中的项生成click事件时遇到问题。我是xaml nad wpf的新手。各位专家能帮助我吗?下面是我提出的代码,但现在不知道如何为生成的项添加click事件。非常感谢您的回复。感谢您的阅读 < itemscontrol itemssource ={Binding Text,Source = {StaticResource TextContainer}}> < itemscontrol.itemspanel> < itemspaneltemplate> < wrappanel itemwidth =100> ItemHeight =100/> < itemscontrol.itemtemplate> < datatemplate datatype ={x:输入sys: String}> < border cornerradius =100> removed =BlueViolet> <按钮保证金=20 内容={Binding} HorizontalContentAlignment =中心/> 解决方案 I am having problems with generating a click event for items inside an items control. I am new to xaml nad wpf. Can you the experts help me out. Below is the code that i have come up with but now having no clue on how to add a click event to for the generated items. Will very much appreciate your responses. Thank you for reading<itemscontrol itemssource="{Binding Text, Source={StaticResource TextContainer}}"> <itemscontrol.itemspanel> <itemspaneltemplate> <wrappanel itemwidth="100"> ItemHeight="100" /> <itemscontrol.itemtemplate> <datatemplate datatype="{x:Type sys:String}"> <border cornerradius="100"> removed="BlueViolet"> <Button Margin="20" Content="{Binding}" HorizontalContentAlignment="Center" /> 解决方案 这篇关于如何为项目控件内的项目添加单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-27 08:58