Bind PieChart inside RadAutoCompleteBox

2 posts, 0 answers
  1. Johnny
    Johnny avatar
    1 posts
    Member since:
    Sep 2012

    Posted 15 Feb 2013 Link to this post

    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>
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 15 Feb 2013 Link to this post

    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.
  3. DevCraft banner
Back to Top