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

Bind PieChart inside RadAutoCompleteBox

1 Answer 35 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Johnny
Top achievements
Rank 1
Johnny asked on 15 Feb 2013, 11:42 AM
I have a RadAutoCompleteBox that binds to a compactdatabase. I whant to bind one piechart with 3 piedatapoints within the radAutoCompleteBox

When i set the PieDataPoint Values the app crashes. (If i set the values to a fixed number it works)

How do you bind the 3 piedatapoints?

Thank you.

<
telerikInput:RadAutoCompleteBox AutoCompletePopupDisplayMode="BelowTextBox" FilterDelay="0:0:0.350" x:Name="radAutoCompleteBox" Grid.Row="1" AutoCompleteMode="Contains">
    <telerikInput:RadAutoCompleteBox.SuggestionItemTemplate>
        <DataTemplate>
            <Grid Margin="0, -3, 0, -3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="{Binding Name}" x:Name="test" telerikInput:RadAutoCompleteBox.IsElementHighlighted="True" FontSize="{StaticResource PhoneFontSizeMedium}">
                    <telerikInput:RadAutoCompleteBox.HighlightStyle>
                        <telerikInput:HighlightStyle Foreground="#3BB23B"/>
                    </telerikInput:RadAutoCompleteBox.HighlightStyle>
                    </TextBlock>
                                             
 
                    <Grid Grid.Row="1" Grid.Column="1">
 
                        <telerikChart:RadPieChart x:Name="pieChart">
                            <telerikChart:PieSeries ShowLabels="True" ValueBinding="Value">
                                
                                <telerikChart:PieSeries.SliceStyles>
                                    <Style BasedOn="{StaticResource BasePieStyle}" TargetType="Path">
                                        <Setter Property="Fill" Value="{StaticResource Brush0}"/>
                                    </Style>
                                    <Style BasedOn="{StaticResource BasePieStyle}" TargetType="Path">
                                        <Setter Property="Fill" Value="{StaticResource Brush1}"/>
                                    </Style>
                                </telerikChart:PieSeries.SliceStyles>
                                 
                                 
 
                                <telerikChart:PieSeries.LabelTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding}" FontSize="14" Foreground="{StaticResource PhoneBackgroundBrush}" FontWeight="Bold"/>
                                    </DataTemplate>
                                </telerikChart:PieSeries.LabelTemplate>
                                <telerikCharting:PieDataPoint Value="{Binding Pie1}" Label="Pie1"></telerikCharting:PieDataPoint>
                                <telerikCharting:PieDataPoint Value="{Binding Pie2}" Label="Pie2"></telerikCharting:PieDataPoint>
                                <telerikCharting:PieDataPoint Value="{Binding Pie3}" Label="Pie3"></telerikCharting:PieDataPoint>
 
                            </telerikChart:PieSeries>
                        </telerikChart:RadPieChart>
                    </Grid>
                </Grid>
            </Grid>
        </DataTemplate>
    </telerikInput:RadAutoCompleteBox.SuggestionItemTemplate>
</telerikInput:RadAutoCompleteBox>

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 15 Feb 2013, 11:48 AM
Hi Johnny,

The pie data points are not dependency objects therefore you cannot bind their values. In order to populate the pie chart with data, please use the ItemsSource property of your pie series. You can find an example here.

All the best,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart
Asked by
Johnny
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or