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

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

1 Answer 52 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.
PEIYANG
Top achievements
Rank 1
PEIYANG asked on 26 Sep 2012, 12:29 PM
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??
  <UserControl.Resources>  
        <example:ExampleViewModel x:Key="ViewModel" />
        <Style x:Key="CustomLegendItemStyle" TargetType="charting:ChartLegendItem">  
            <Setter Property="Foreground" Value="Black" />
            <Setter Property="Template" >
                <Setter.Value>
                    <ControlTemplate TargetType="charting:ChartLegendItem">
                        <Grid x:Name="PART_MainContainer" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0,0,5,0">
                            <Path x:Name="PART_LegendItemMarker"
                                  Height="20"
                                  Width="100"
                                  Style="{TemplateBinding ItemStyle}"
                                  Stretch="Fill">
                                <Path.Data>
                                    <PathGeometry x:Name="PART_ItemMarkerGeometry" />
                                </Path.Data>
                            </Path>
                            <CheckBox IsChecked="True"  x:Name="checkbox1"
                                      VerticalAlignment="Center"
                                      Margin="2,0"
                                      Content="{TemplateBinding Label}"
                                      Foreground="{TemplateBinding Foreground}"
                                      Command="{Binding Path=ChangeSeriesVisibilityCommand, Source={StaticResource ViewModel}}"
                                      CommandParameter="{TemplateBinding Label}"
                                      />
                    </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
 

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar Kirov
Telerik team
answered on 01 Oct 2012, 10:38 AM
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.

Tags
Chart
Asked by
PEIYANG
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Share this question
or