I'm writing an application in C# with WPF. I have a List of Objects in my code that I want to map to a Grid. The List resembles data from a 2D field. The width (x-coordinate) and height (y-coordinate) of the field can change. I'm using an ItemsContol with a UniformGrid as ItemsPanelTemplate. So far, it works.
However, now I want the user to be able to draw a line between two y-coordinates, so for example between y=6 and y=7.
I tried to add a Separator or a Line to the UniformGrid, but unfortunately, that doesn't work. I did get these to work for a Grid with a defined number of columns and rows, but unfortunately, I don't have fixed columns and rows.
I don't know how to get this to work, so any help would be greatly appreciated! Thanks a lot.
See the code below for the ItemsControl:
<ItemsControl Name="Field" ItemsSource="{Binding visible, UpdateSourceTrigger=PropertyChanged}"><ItemsControl.ItemsPanel><ItemsPanelTemplate><UniformGrid Columns="{Binding cols}" HorizontalAlignment="left" VerticalAlignment="top" Name="GridName"></UniformGrid></ItemsPanelTemplate></ItemsControl.ItemsPanel><ItemsControl.ItemTemplate><DataTemplate><Border BorderBrush="Black" BorderThickness="1" Height="20"><TextBlock Text="{Binding Path=inputEntries.EntryNR}" MouseDown="CellClick" Width="50" TextAlignment="Center" VerticalAlignment="Center" Background="{Binding Path=Intrial, UpdateSourceTrigger=PropertyChanged}"/></Border></DataTemplate></ItemsControl.ItemTemplate></ItemsControl>