Make all the colors consistent

4 posts, 1 answers
  1. Trump
    Trump avatar
    16 posts
    Member since:
    Nov 2017

    Posted 15 Nov Link to this post

    I manually set the color of a Line Series in xaml as Blue. Now in tooltip I also want the same color.

    <telerik:LineSeries x:Name=ser1 ItemsSource="{Binding Data}"
    CategoryBinding="Name" Stroke="Blue" ValueBinding="Value">
       <telerik:LineSeries.TooltipTemplate>
            <DataTemplate>
                 <SatckPanel>
                    <ItemsControls ItemsSource="{Binding}">
                        <ItemsControl.Template>
                            <DataTemplate>
                               <Ellipse Width="12" Height="12" Fill="Blue">
                        ....
                            </DataTemplate>
                         </ItemsControl.Template>
                    <ItemsControls>
                </StackPanel>
             </DataTemplate>
        </telerik:LineSeries.TooltipTemplate>
    </telerik:LineSeries>

    Now my question if we don't use hard code how can we make the colors same?

  2. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    1475 posts

    Posted 16 Nov Link to this post

    Hello Trump,

    The data context in the tooltip template is DataPoint object which contains information about the series. You can use this to get its Stroke and color the tooltip accordingly.
    <telerik:LineSeries.TooltipTemplate>
        <DataTemplate>
             <StackPanel Background="{Binding Presenter.Stroke}">
             </StackPanel>
        </DataTemplate>
    </telerik:LineSeries.TooltipTemplate>
    In this case 'Presenter' is a property of DataPoint which holds a reference to the LineSeries.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Trump
    Trump avatar
    16 posts
    Member since:
    Nov 2017

    Posted 16 Nov in reply to Martin Ivanov Link to this post

    BindingExpression path error: 'Presenter' property not found on 'object'  ' 'String'  (HashCode=-1744993425)'
  4. Trump
    Trump avatar
    16 posts
    Member since:
    Nov 2017

    Posted 16 Nov in reply to Trump Link to this post

    Never mind. It works. Ignore my reply above please.
Back to Top