Getting selected item in ItemsControl

后端 未结 2 1947
遥遥无期
遥遥无期 2021-02-13 15:18

I have the following code which populates my user control in form of rows and column. The user control which is being populated contains Button, links, textbox etc. When a certa

2条回答
  •  孤街浪徒
    2021-02-13 15:40

    ItemsControl can't select items, only present collections. Only a Selector or one of it's descendants can select items.

    For your scenario, I think a ListView with GridView would fit. When the user would click a control in the line, the event would bubble to the ListView and the item would get selected. You can override the default styles so it wouldn't display as selected line: WPF ListView turn off selection.

提交回复
热议问题