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
320
CategoryToolTipLayer without badge but Legend item with badge
posted

Hello,

I'm working with XamDataChart CategoryToolTipLayer. I want to display tooltip without badge, but I need a badge on legend item. How to make it?? Thanks in advance! 

Here is my code:

<DataTemplate x:Key="LocalLegendItemTemplate">
            <DockPanel Margin="1" Visibility="{Binding Series.Visibility}">
                <ContentPresenter Margin="2"
                                  HorizontalAlignment="Left"
                                  Content="{Binding}"
                                  ContentTemplate="{Binding Series.LegendItemBadgeTemplate}"
                                  DockPanel.Dock="Left" />
                <ContentPresenter Margin="2"
                                  HorizontalAlignment="Right"
                                  Content="{Binding Series.Title,
                                                    TargetNullValue=Series Title}"
                                  DockPanel.Dock="Right" />
            </DockPanel>
        </DataTemplate>
 
        <DataTemplate x:Key="LocalLegendItemRectBadgeTemplate">
            <Grid Width="5"
                  Height="5"
                  Margin="5,0,5,0">
                <Rectangle Width="5"
                           Height="5"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"
                           Effect="{Binding Series.Effect}"
                           Fill="{Binding Series.ActualBrush}"
                           Stroke="{Binding Series.ActualOutline}"
                           StrokeLineJoin="Round"
                           StrokeThickness="{Binding Series.Thickness}" />
                <ContentPresenter Width="5"
                                  Height="5"
                                  Margin="0"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Center"
                                  Content="{Binding}"
                                  ContentTemplate="{Binding Series.ActualMarkerTemplate}" />
            </Grid>
        </DataTemplate>
<Style x:Key="Series" TargetType="ig:Series">
            <Setter Property="MinWidth" Value="5" />
            <Setter Property="Thickness" Value="1" />
            <Setter Property="MinHeight" Value="5" />
            <Setter Property="LegendItemTemplate" Value="{StaticResource LocalLegendItemTemplate}" />
            <Setter Property="LegendItemBadgeTemplate" Value="{StaticResource LocalLegendItemRectBadgeTemplate}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ig:Series">
                        <Canvas x:Name="RootCanvas">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="MouseOver" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                        </Canvas>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

<DataTemplate x:Key="LocalLegendItemBadgeTemplate">
            <Grid>
                <!--<Rectangle Width="5"
                           Height="5"
                           Margin="5,0,5,0"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"
                           Effect="{Binding Series.Effect}"
                           Fill="{Binding Series.ActualBrush}"
                           Stroke="{Binding Series.ActualOutline}"
                           StrokeLineJoin="Round"
                           StrokeThickness="{Binding Series.Thickness}" />-->
            </Grid>
        </DataTemplate>
<Style x:Key="LocalToolTipStyle" TargetType="ContentControl">
            <Setter Property="Background" Value="{StaticResource TooltipBackgroundBrush}" />
            <Setter Property="BorderBrush" Value="{StaticResource TooltipBorderBrush}" />
            <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
            <Setter Property="FontSize" Value="12" />
            <Setter Property="FontFamily" Value="Segoe UI Light" />
            <Setter Property="Padding" Value="5" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ContentControl">
                        <Border>
                            <Border Background="{TemplateBinding Background}"
                               BorderBrush="{TemplateBinding BorderBrush}"
                               BorderThickness="1">
                                <StackPanel Orientation="Horizontal">
                                    <ContentPresenter Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" />
                                </StackPanel>
                            </Border>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
<Style x:Key="LocalPointerToolTipStyle" TargetType="ig:PointerTooltip">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ig:PointerTooltip">
                        <Canvas x:Name="PART_RootCanvas">
                            <ContentControl x:Name="PART_CONTENT"
                                            Canvas.Left="{Binding Path=ActualBoxTopLeftPosition.X,
                                                                  RelativeSource={RelativeSource TemplatedParent}}"
                                            Canvas.Top="{Binding Path=ActualBoxTopLeftPosition.Y,
                                                                 RelativeSource={RelativeSource TemplatedParent}}"
                                            Style="{TemplateBinding ToolTipStyle}">
                                <ContentPresenter Content="{TemplateBinding Content}" />
                            </ContentControl>                          
                        </Canvas>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
<Style BasedOn="{StaticResource Series}" TargetType="ig:CategoryToolTipLayer">
            <Setter Property="LegendItemBadgeTemplate" Value="{StaticResource LocalLegendItemBadgeTemplate}" />
            <Setter Property="ToolTipStyle" Value="{StaticResource LocalToolTipStyle}" />
            <Setter Property="PointerToolTipStyle" Value="{StaticResource LocalPointerToolTipStyle}" />
        </Style/>

Parents
No Data
Reply
  • 30945
    Verified Answer
    Offline posted

    Hello Nikolay,

     

    Thank you for your post. I have been looking into the question that you are having and the what is shown in the CategoryTooltipLayer is controlled by the CrosshairTooltipItemTemplate. You can change the template to show only the series information, without the badge template. I have created a sample application for you, that shows how you can implement this approach.

     

    Sincerely,

    Krasimir, MCPD

    Developer Support Supervisor - XAML

    Infragistics

    www.infragistics.com/support

    TooltipLayerNoBadge.zip
Children