This is a migrated thread and some comments may be shown as answers.

Make all the colors consistent

3 Answers 51 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Trump
Top achievements
Rank 1
Trump asked on 16 Nov 2017, 02:28 AM

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?

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 16 Nov 2017, 08:12 AM
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.
0
Trump
Top achievements
Rank 1
answered on 16 Nov 2017, 02:17 PM
BindingExpression path error: 'Presenter' property not found on 'object'  ' 'String'  (HashCode=-1744993425)'
0
Trump
Top achievements
Rank 1
answered on 16 Nov 2017, 02:23 PM
Never mind. It works. Ignore my reply above please.
Tags
ChartView
Asked by
Trump
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Trump
Top achievements
Rank 1
Share this question
or