How to get the control in resource when I show the chart using mvvm binding?

2 posts, 1 answers
    PEIYANG avatar
    65 posts
    Member since:
    Jul 2012

    Posted 26 Sep 2012 Link to this post

    in this sample http://localhost:6519/Default.aspx#Chart/SimpleFiltering,I want to get the control called checkbox1,but I cant get it with this.checkbox1,How to get the checkbox1??
            <example:ExampleViewModel x:Key="ViewModel" />
            <Style x:Key="CustomLegendItemStyle" TargetType="charting:ChartLegendItem">  
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="Template" >
                        <ControlTemplate TargetType="charting:ChartLegendItem">
                            <Grid x:Name="PART_MainContainer" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0,0,5,0">
                                <Path x:Name="PART_LegendItemMarker"
                                      Style="{TemplateBinding ItemStyle}"
                                        <PathGeometry x:Name="PART_ItemMarkerGeometry" />
                                <CheckBox IsChecked="True"  x:Name="checkbox1"
                                          Content="{TemplateBinding Label}"
                                          Foreground="{TemplateBinding Foreground}"
                                          Command="{Binding Path=ChangeSeriesVisibilityCommand, Source={StaticResource ViewModel}}"
                                          CommandParameter="{TemplateBinding Label}"
  2. Answer
    Petar Kirov
    Petar Kirov avatar
    425 posts

    Posted 01 Oct 2012 Link to this post

    Hello Peiyang,

      I suggest that you review the msdn documentation and more specifically this topic where it is shown how to access control-template generated elements.
    Please note that this is a general question which is not directly related to our controls and the implementation of this code is out of our support scope.
    If you have any more frustrations/questions on this - please ask them in the official Microsoft Silverlight forums or in StackOverflow.
    Kind regards,
    Petar Kirov
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top