Elina Posted January 18, 2010 Report Share Posted January 18, 2010 I use the version 8.0.3581.26941 I have two Q. 1. How do I do 2 different LegendBoxes instead use a grouping in one Legend? 2. I haven't added tooltips for LegendBox Items ( I won't use a scrool bar in the legend box, but tooltip for the long items only). I've tried to add a tooltip definition to DataTemplate\ContentControl like this, but it's not working. What can I do? <DataTemplate x:Key="CheckableLegend"> <DataTemplate.Resources> <cfxConverters:VisibilityToBooleanConverter x:Key="VisibilityToBool"/> </DataTemplate.Resources> <Grid Name="grid"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" SharedSizeGroup="FirstRow" /> <ColumnDefinition Width="*" SharedSizeGroup="FirstRow" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions><CheckBox VerticalAlignment="Center" Background="{Binding Path=Fill}" IsChecked="{Binding Path=Series.Visibility, Converter={StaticResource VisibilityToBool}}" Grid.Column="0" Margin="1,0,1,0"/><cfxControls:MarkerLegendControl Content="{Binding Path=Self}" Grid.Column="1" /> <Border Background="Transparent" Grid.Column="2" VerticalAlignment="Center"><ContentControl IsHitTestVisible="false" ToolTip="{Binding Path=Content}" Content="{Binding Path=Content}" ContentTemplate="{Binding Path=ContentTemplate}"Foreground="{Binding Path=Foreground}" FontFamily="{Binding Path=FontFamily}" FontSize="{Binding Path=FontSize}" FontStyle="{Binding Path=FontStyle}" FontWeight="{Binding Path=FontWeight}"/> </Border> </Grid> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=Dimmed}"><DataTrigger.Value>True </DataTrigger.Value> <Setter Property="Opacity" Value="0.25" TargetName="grid" /> </DataTrigger> </DataTemplate.Triggers> </DataTemplate>Thanks, Elina Quote Link to comment Share on other sites More sharing options...
JuanC Posted January 18, 2010 Report Share Posted January 18, 2010 Can you expand on what do you want to achieve in Q1? Feel free to post a modified chart image if needed. JuanC Quote Link to comment Share on other sites More sharing options...
Elina Posted January 19, 2010 Author Report Share Posted January 19, 2010 Hi, JuanC I use the multiply panes chart and my LegendBox contains two groups for separate the series from different panes. I want to separate the Legend to two different boxes ( if it's possible, of course ) and align each of them to appropriate pane. What about the Q2: Tooltips for Legend Items? Thanks P.S. How can I add pictures from my computer and not from URL? Quote Link to comment Share on other sites More sharing options...
Elina Posted January 24, 2010 Author Report Share Posted January 24, 2010 Any ideas about my issue? Quote Link to comment Share on other sites More sharing options...
JuanC Posted January 26, 2010 Report Share Posted January 26, 2010 About creating 2 legend boxes, we currently do not support this but you can use grouping and styling to achieve something very similar, the following code assumes you have 4 series in your chart. chart1.LegendBox.ItemAttributes[chart1.Series, 0].Group = "G1";chart1.LegendBox.ItemAttributes[chart1.Series, 1].Group = "G1"; chart1.LegendBox.ItemAttributes[chart1.Series, 2].Group = "G2"; chart1.LegendBox.ItemAttributes[chart1.Series, 3].Group = "G2"; chart1.LegendBox.GroupCategories = true; chart1.LegendBox.DockBorder = DockBorder.None; chart1.LegendBox.GroupStyle = (GroupStyle) FindResource("GroupBorder"); XAML <GroupStyle x:Key="GroupBorder"> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <Border CornerRadius="4" BorderBrush="#808080" BorderThickness="1" Margin="0,4"> <StackPanel> <TextBlock FontWeight="Bold" Text="{Binding Path=Name}" HorizontalAlignment="Center"/> <ItemsPresenter Margin="0,0,0,8"/> </StackPanel> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </GroupStyle.ContainerStyle> </GroupStyle> JuanC Quote Link to comment Share on other sites More sharing options...
Elina Posted January 27, 2010 Author Report Share Posted January 27, 2010 Thanks. That's as exactly as I need! Now, I need to attach a Tooltips to LegendBox items. I use the vertical Legend on the right side with fixed width, and the long items aren't visible fully. I can add ToolTip to all the LegendBox, but I don't know how to add tooltip to each item and bind the Item Content as the tooltip text. Quote Link to comment Share on other sites More sharing options...
Elina Posted January 27, 2010 Author Report Share Posted January 27, 2010 I'm again. I've gotten the tooltips for LegendBox iems in this way. What do you think, Is it right way? <cfx:LegendBox.ContainerStyle> <Style TargetType="{x:Type ItemsControl}"> <Style.Setters> <Setter Property="ItemContainerStyle"> <Setter.Value> <Style> <Style.Triggers> <Trigger Property="Control.IsMouseOver" Value="True"> <Setter Property="Control.ToolTip" Value="{Binding Content}"/> </Trigger> </Style.Triggers> </Style> </Setter.Value> </Setter> </Style.Setters> </Style> </cfx:LegendBox.ContainerStyle> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.