I needed to be able to quickly and easily change the display of items in the ListBox . Of course, everything in it is very inconvenient, if the display often has to be changed, add new templates, and so on. Then I began to look towards the ListView with its View property.
However, there is very little information on the Internet about its use and it is very scarce. On MSDN only superficial description.
Here it is more, but much is again not clear. They redefined the ViewBase class by adding the public DataTemplate ItemTemplate property to it. But I can not understand how this property is used, because it does not exist in the ViewBase , which means it needs to be sent to the ListView.ItemTemplate . But how it is done there is not said.
In addition, you also need to change the panel on the run ( ItemsPanelTemplate ). Somewhere you need a WrapPanel , somewhere a StackPanel , somewhere in general a UniformGrid .
Following the logic, I added the ItemsPanelTemplate PanelTemplate property from the ViewBase to my class. But what to do with this next? In short, how can I ensure that I change the View property of a ListView , pointing to a resource, and the ListView display (the panel and all elements) changes completely?
