1
以下の画像のように凡例を使用します。凡例が正しく整列していません
だから、正方形はタイトルが右側にあり、左側にあります。 私のコードは次のとおりです。
<Grid>
<TextBlock Text="{Binding Title}" Foreground="White" Margin="15 0 0 0" HorizontalAlignment="Left"/>
<Path Width="12"
Height="12"
Fill="{Binding MarkerFill}"
HorizontalAlignment="Left" >
<Path.Data>
<Binding Path="ActualMarkerGeometry"
RelativeSource="{RelativeSource AncestorType=telerik:LegendItemControl}">
</Binding>
</Path.Data>
</Path>
</Grid>
私の質問は、テキストが正しく揃えされていないということです。これは、テキストを左ではなく右に揃えます。下の画像を参照してください。
更新コード
<telerik:RadLegend.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Path Width="15" Height="15" Fill="{Binding MarkerFill}"
HorizontalAlignment="Left" Grid.Column="0">
<Path.Data>
<Binding Path="ActualMarkerGeometry"
RelativeSource="{RelativeSource AncestorType=telerik:LegendItemControl}">
</Binding>
</Path.Data>
</Path>
<TextBlock Text="{Binding Title}" Foreground="White" Margin="15 0 0 0" HorizontalAlignment="Left" Grid.Column="1" />
</Grid>
</DataTemplate>
</telerik:RadLegend.ItemTemplate>
問題を再現できるコードを表示してください。コードを見ると、列でグリッドを作成し、TextBlockとPathを適切な列に割り当てることをお勧めします。 –
私はそれを行い、TextBlockとPathを適切な列に割り当てます。同じこと。 – Bigeyes
更新されたコードを投稿 –