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

How do I access component within

1 Answer 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
s2uiguy
Top achievements
Rank 1
s2uiguy asked on 02 Jun 2011, 03:34 PM
Hi - I have a RadGridView that I have created a custom cell template for one of the columns to display a label and a progress bar.
At certain times I will be receiving a message from the backend that will require me to access a method within the StateProgressBar's code behind.  
For example, say I have 5 rows of data and I get a message from the server that says that I should stop the progress bar in row 5.

In the code behind, is there a way for me to achieve this? 

...
              <telerik:GridViewDataColumn Header="State">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Vertical">
                                <TextBlock HorizontalAlignment="Center"
                                       Text="{Binding state}" FontSize="10"/>
                            <local:StateProgressBar  x:Name="stateProgressBar" TimerInMilliseconds="{Binding displayTimerExpirationTime}"/>
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
...

Thank you!

FortPointUIGuy

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 08 Jun 2011, 06:25 AM
Hello fortpointuiguy,

You may try finding the desired CellTemplate element in the visual tree like this:
(radGridView.ItemContainerGenerator.ContainerFromIndex(4) as GridViewRow).ChildrenOfType<StateProgressBar>().First();


Regards,
Ivan Ivanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
s2uiguy
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or