Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > GridView > How access controls in RowDetails?

Not answered How access controls in RowDetails?

Feed from this thread
  • Rob Ainscough avatar

    Posted on Feb 2, 2012 (permalink)

    How do I access via code behind (VB) the controls in a RowDetails DataTemplate?

    Example XAML:
    <DataTemplate x:Key="TransactionDetailDataTemplate">
        <Grid MinHeight="28" Style="{StaticResource RowDetailBackground}">
     
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="680"/>
                <ColumnDefinition Width="100"/>
            </Grid.ColumnDefinitions>
     
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
             
            <ListBox x:Name="TransactionDetailListBox" Margin="100,0,0,0" Background="{x:Null}" DataContext="{Binding Source={StaticResource TransactionDetailData}}" BorderBrush="{x:Null}" FontSize="10.667">
                <ListBoxItem Content="{Binding Collection[0].Description1}" />
            </ListBox>
             
            <Button x:Name="WaiveFeeButton" Content="Wavie Fee" Grid.Column="1" Style="{StaticResource AcceptButton}" Visibility="Collapsed" />
             
        </Grid>
    </DataTemplate>

    In my code behind I have:

    Private Sub TransactionGridView_RowDetailsVisibilityChanged(sender As Object, e As Telerik.Windows.Controls.GridView.GridViewRowDetailsEventArgs) Handles TransactionGridView.RowDetailsVisibilityChanged
     
        ' DEMO - for demo only
        If Not TransactionGridView.CurrentItem Is Nothing Then
     
            Dim RowObject As Object = TransactionGridView.CurrentItem
            If RowObject.TxDescription = "Charge" Then
                ' Make the Waive Fee Button Visible
     
            End If
     
        End If
     
    End Sub

    Code behind will not recognize the WaiveFeeButton as being directly accessible.  How can I set the visibility of this button in code behind?

    Rob

    Reply

  • Maya Maya admin's avatar

    Posted on Feb 3, 2012 (permalink)

    Hi Rob,

    I would recommend you to work with the arguments of the event instead. Please refer to our online documentation for a reference. 

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Vlad Vlad admin's avatar

    Posted on Feb 3, 2012 (permalink)

    Hi,

     I strongly suggest you to use MVVM pattern to achieve your goal. In this case you should bind Visibility of the Button to desired property in your model using IValueConverter. 

    Regards,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Rob Ainscough avatar

    Posted on Feb 6, 2012 (permalink)

    Sorry, but I find MVVM way too verbose and worky and far to imposing (restrictive).  I'm not a fan of MVVM, it forces a human interaction that is not natural to anyone other than developers and/or folks that think in logical patterns ... my end users are rarely those types of people.  MVVM may make sense from a developers perspective, but I'm not coding applications for developers and my end user rarely think the same way a developer does, very rare!  I'm not suggesting right or wrong, just the reality of real world applications over a broad audience/user.

    Back to the sample code from your link ... if I understand correclty, I can use the LoadingRowDetails and assign it to an event handler ... that's all good.  But specific details about the row will be available thru e (GridViewRowDetailsEventArgs)?

    Thanks,
    Rob

    Reply

  • Maya Maya admin's avatar

    Posted on Feb 7, 2012 (permalink)

    Hi Rob,

    Indeed, you can work with the arguments of the event - you can get the element defined in RowDetailsTemplate, the corresponding row and the state of the row details - whether they are visible or collapsed. 

    Regards,
    Maya
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > GridView > How access controls in RowDetails?
Related resources for "How access controls in RowDetails?"

Silverlight Grid Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]