C# WPF多段线-如何高亮显示点?

C# WPF多段线-如何高亮显示点?,c#,wpf,xaml,C#,Wpf,Xaml,您好,我有一个关于WPF中多段线的问题。如何高亮显示多段线中的点,例如线是红色的,但点是蓝色的。点是蓝色的。Apolyline不能立即高亮显示,因为它仅作为连接线段的集合进行渲染 但是,您可以添加一个ItemsControl,以呈现如下所示的点。它使用长度为零的行元素,但具有圆形的起始和结束封口以显示点 <Polyline x:Name="polyline" Points="10,10 50,50 90,10" Stroke="Red"/> <ItemsControl Ite

您好,我有一个关于WPF中多段线的问题。如何高亮显示多段线中的点,例如线是红色的,但点是蓝色的。点是蓝色的。

A
polyline
不能立即高亮显示,因为它仅作为连接线段的集合进行渲染

但是,您可以添加一个
ItemsControl
,以呈现如下所示的点。它使用长度为零的
元素,但具有圆形的起始和结束封口以显示点

<Polyline x:Name="polyline" Points="10,10 50,50 90,10" Stroke="Red"/>

<ItemsControl ItemsSource="{Binding Points, ElementName=polyline}">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <Canvas/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemContainerStyle>
        <Style TargetType="ContentPresenter">
            <Setter Property="Canvas.Left" Value="{Binding X}"/>
            <Setter Property="Canvas.Top" Value="{Binding Y}"/>
        </Style>
    </ItemsControl.ItemContainerStyle>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <Line Stroke="Blue" StrokeThickness="5"
                  StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

请查看帮助中心中的。