Separator in ListView (WPF)?

后端 未结 2 1693
别跟我提以往
别跟我提以往 2021-01-12 19:55

I\'m gonna insert a Separator in a ListView in WPF , something like this :
image

I\'ve used the following XAML code, but it dosn\'t work !



        
相关标签:
2条回答
  • 2021-01-12 20:30

    Mohammad,

    I believe inserting a separator (or a control which mimics one) is far more simple than you think :)

    First of all, please take a look on how DataTemplate should be applied to a ListBox/ListView. You can find it here. Secondly, you have to decide how you're going to mimic a Separator. You can find 2 excellent examples here and here. Please keep me informed if your task is done :)

    0 讨论(0)
  • 2021-01-12 20:45

    Try putting the separator in the collection of items you are binding to. In the above code you are stting the items via the itemsSource binding and then setting the items by adding a seperator to the content. Add the seperator to the collection of items and you will see a blank row in your grid. you might have to style the separator accordingly. (but it will give you a row you cant click on)

    0 讨论(0)
提交回复
热议问题