Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
how to make legend item wrap text
posted

Hello,

I am using version 7.2.20072.1007 of the WPF controls.

My question is how can I make the legend items wrap when the width of the text exceeds the width of the legend? I am using the chart 3D styles you guys ship. I tried modifying the data template, specifically adding TextWrapping="WrapWithOverflow" to the TextBlock but it still does not wrap. Any ideas?

Thanks

 

 

<DataTemplate DataType="{x:Type igCA:LegendItemTemplate}">

<Grid Background="{x:Null}" Margin="0,0,0,0" Width="Auto" Height="Auto">

 

<!--<StackPanel Orientation="Horizontal" Width="Auto" Height="Auto">

<Grid Width="Auto">

<Ellipse

Fill="{Binding Path=Fill}"

Width="12"

Height="12"

StrokeThickness="1"

/>

</Grid>

<TextBlock Text="{Binding Path=Text}" FontFamily="Tahoma"

FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Left" Background="{x:Null}" Margin="3,0,0,0" TextWrapping="Wrap"/>

</StackPanel>-->

<Grid>

 

<Grid.ColumnDefinitions>

<ColumnDefinition Width="Auto"/>

<ColumnDefinition Width="Auto"/>

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition Height="Auto"/>

</Grid.RowDefinitions>

 

<Ellipse

Fill="{Binding Path=Fill}"

Width="12"

Height="12"

StrokeThickness="1"

/>

 

<TextBlock Grid.Column="1" Text="{Binding Path=Text}" FontFamily="Tahoma"

FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Left" Background="{x:Null}" Margin="3,0,0,0" TextWrapping="WrapWithOverflow"/>

</Grid>

</Grid>

</DataTemplate>

Parents
No Data
Reply
  • 28496
    Offline posted

     strange, i thought i answered this on wednesday.  this is just an issue with the grid panel ... if you set an explicit width on that second column, your text wrapping should take effect.

     

    <Grid.ColumnDefinitions>

    <ColumnDefinition Width="Auto"/>

    <ColumnDefinition Width="50"/>

    </Grid.ColumnDefinitions>

     

Children