XAMLは、期待される結果、つまり端が丸い線を生成します。
ただし、同じPathGeometryをバインドするデータは、フラットエンドを生成します。これがなぜなのかわかりませんが、誰か説明できますか?
簡単な例を次に示します。
XAML:
<Grid>
<Path Fill="Green" Stroke="Black" StrokeThickness="8"
Stretch="None" IsHitTestVisible="False"
Data="{Binding IndicatorGeometry}"
StrokeStartLineCap="Round" StrokeEndLineCap="Round"/>
<!--<Path Fill="Green" Stroke="Black" StrokeThickness="8"
Stretch="None" IsHitTestVisible="False"
StrokeStartLineCap="Round" StrokeEndLineCap="Round">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="64,64">
<LineSegment Point="128,8"/>
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>-->
</Grid>
C#:
private static PathFigure[] ms_figure = new []
{
new PathFigure(
new Point(64, 64),
new[]
{
new LineSegment(new Point(128, 8), false)
},
true)
};
public PathGeometry IndicatorGeometry
{
get { return (PathGeometry)GetValue(IndicatorGeometryProperty); }
set { SetValue(IndicatorGeometryProperty, value); }
}
public static readonly DependencyProperty IndicatorGeometryProperty =
DependencyProperty.Register("IndicatorGeometry", typeof(PathGeometry), typeof(MainWindow),
new FrameworkPropertyMetadata(new PathGeometry(ms_figure)));
public MainWindow()
{
InitializeComponent();
DataContext = this;
}