0

I'm making Ford-Fulkerson visualizer using wpf. In order to display my graph I'm using ItemsControl with DataTemplate like this:

<ItemsControl ItemsSource="{Binding Edges}" Panel.ZIndex="1">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <Canvas />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.Resources>
        <DataTemplate DataType="{x:Type local:Edge}">
            <Grid>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Flow}"></TextBlock>
                    <TextBlock Text="/"></TextBlock>
                    <TextBlock Text="{Binding Capacity}"></TextBlock>
                </StackPanel>
                <arrows:ArrowLine StrokeThickness="1" Stroke="Black"
                                  X1="{Binding StartPoint.X}" Y1="{Binding StartPoint.Y}"
                                  X2="{Binding EndPoint.X}" Y2="{Binding EndPoint.Y}"
                                  ArrowEnds="End" ArrowLength="10"></arrows:ArrowLine>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type local:PrimaryEdge}">
            <Grid>
                <arrows:ArrowLine StrokeThickness="1" Stroke="Black"
                                  X1="{Binding StartPoint.X}" Y1="{Binding StartPoint.Y}"
                                  X2="{Binding EndPoint.X}" Y2="{Binding EndPoint.Y}"
                                  ArrowEnds="End" ArrowLength="10"></arrows:ArrowLine>
            </Grid>
        </DataTemplate>
    </ItemsControl.Resources>
</ItemsControl>

This code displays me edges correctly but i'm also need to display flow and capacity for each edge. Here is how my graph displays now, the 7/13 in left top corner is the flow and capacity that i want to position near the edges. How can i achieve this?

0 Answers0