列表项命令 [英] List Item Commands
问题描述
我有一个项目列表.该列表具有一个CommandBar.当我向命令栏添加命令时,它会在列表中的每个项目下方放置一个按钮.
I have a list of items. The list has a CommandBar. When I added a command to the command bar, it put a button under every item in the list.
我希望根据按钮所附加的项目来启用或禁用按钮.
I want to have the buttons enabled or disabled based on the item the button is attached to.
如果我编辑按钮的CanExecute方法,则不会传递按钮所要使用的项目.我可以看到如何进入所选项目,但是随后同时启用或禁用了所有按钮.我似乎需要某种方式来启用/禁用 按钮,因为数据已绑定到列表中的每一行,但我看不到.
If I edit the CanExecute method of the button, I do not get passed the item the button is for. I can see how I would get to the selected item, but then all the buttons are enabled or disabled simultaneously. What it seems I need is some way to enable/disable the buttons as the data is bound to each row in the list but I don't see one.
我该怎么做?
推荐答案
嗨迈克尔
请查看此线程.我相信您会找到答案的.
Please look into this thread. I believe you will find your answers.
这篇关于列表项命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!