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
3220
xamDataChart StackedcolumnSeries custom Tooltip
posted

Hello,

I would like to use a custom tooltip for the stackedcolumnseries, but it seems not to work, although I tried it as suggested in other posts.

The item object is not haveing the right object information. It doesn't represent the item of the ItemsDataSource.

This is the error I get:

System.Windows.Data Error: 40 : BindingExpression path error: 'GroupId' property not found on 'object' ''5b61ea55-ba58-4112-a5dd-99d6c7f7c7ef__proxy' (HashCode=56811240)'. BindingExpression:Path=Item.GroupId; DataItem='DataContext' (HashCode=15915816); target element is 'Run' (HashCode=45754591); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'Value' property not found on 'object' ''5b61ea55-ba58-4112-a5dd-99d6c7f7c7ef__proxy' (HashCode=56811240)'. BindingExpression:Path=Item.Value; DataItem='DataContext' (HashCode=15915816); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')

<UserControl.Resources>
        <DataTemplate x:Key="tooltipTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,5,0">
                                <Run Text="Valve Nr"/><Run Text=":"/>
                </TextBlock>
                <TextBlock Grid.Row="0" Grid.Column="1">
                                <Run Text="{Binding Path=Item.GroupId}"/>
                </TextBlock>

                <TextBlock Grid.Row="1" Grid.Column="0" Margin="0,0,5,0">
                                <Run Text="{Binding Path=Series.Title}"/><Run Text=":"/>
                </TextBlock>
                <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Item.Value}" />
            </Grid>
        </DataTemplate>
    </UserControl.Resources>

<ig:XamDataChart.Series>
                <ig:StackedColumnSeries ItemsSource="{Binding ChartItemsGroup}"
                                        XAxis="{Binding ElementName=xAxis}"
                                        YAxis="{Binding ElementName=yAxis}"                             
                                        AutoGenerateSeries="True" Legend="{Binding ElementName=Legend}"
                                        SeriesCreated="StackedColumnSeries_SeriesCreated">
                    <ig:StackedColumnSeries.ToolTip>
                        <Grid>
                            <ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource tooltipTemplate}"/>
                        </Grid>
                    </ig:StackedColumnSeries.ToolTip>
                </ig:StackedColumnSeries>
            </ig:XamDataChart.Series>

Where .Value and .GroupId are the properties of my object.

www.infragistics.com/.../custom-series-with-data-point-tracker