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

RowDetailsVisibilityChanged event not firing ?

1 Answer 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
kumar p
Top achievements
Rank 1
kumar p asked on 28 May 2010, 08:22 AM
  
hi i am  using  master/ child concept in grid
 where once i click my button of  my first grid view i need   to show  data in second grid view.
 here i have an button  event where i  do  row expand and collpase functionality . to call my  RadGrid1_RowDetailsVisibilityChanged event

.cs code.
  private void ExpandLevel1_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Button btnExpandCollapse = sender as Button;
                Image imgScore = (Image)btnExpandCollapse.FindName("imgLevel1");
                DependencyObject dep = (DependencyObject)e.OriginalSource;
                while ((dep != null) && !(dep is GridViewRow))
                {
                    dep = VisualTreeHelper.GetParent(dep);
                }
                if (dep != null && dep is GridViewRow)
                {
                    GridViewRow row1 = (GridViewRow)dep;
                    if (row1.DetailsVisibility == Visibility.Visible)
                    {
                        imgScore.Source = new BitmapImage(new Uri("/Images/left_side.png", UriKind.Relative));
                        row1.DetailsVisibility = Visibility.Collapsed;
                    }
                    else
                    {
                        imgScore.Source = new BitmapImage(new Uri("/Images/down_side.png", UriKind.Relative));
                        row1.DetailsVisibility = Visibility.Visible;
//once row1.DetailsVisibility = Visibility.Visible;
we  will be  calling  RowDetailsVisibilityChanged event right now this is not happening
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 is there any  property that i need  to enable. plz let me know. any solution on this would be greatly appreciated.

xaml code

 <telerik:RadGridView   
                        x:Name="RadGrid1"    ShowGroupPanel="False"  RowIndicatorVisibility="Collapsed"  BorderThickness="0"
                        CanUserInsertRows="False"     CanUserResizeColumns="False" RowHeight="24"   
                        CanUserFreezeColumns="False" SelectionMode="Extended"
                          RowDetailsVisibilityMode="Collapsed"     IsReadOnly="True"
                         AutoGenerateColumns="False"  CanUserReorderColumns="False"
                         Height="Auto" Width="Auto" Background="#FFC6C6C6" RowLoaded="RadGrid1_RowLoaded" DataLoading="RadGrid1_DataLoading" RowDetailsVisibilityChanged="RadGrid1_RowDetailsVisibilityChanged" SelectionChanged="RadGrid1_SelectionChanged">
        
            <telerik:RadGridView.Columns>
<telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Button x:Name="myButton"   
                          Click="ExpandLevel1_Click">
                                <Image  x:Name="imgLevel1" Source="Images/left_side.png" Stretch="None" />
                            </Button>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding UniqueName}"   IsVisible="False"  />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}"  IsVisible="False" />
                <telerik:GridViewDataColumn Header="KPI"  Width="*" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <my:Label Content="{Binding KPI}"  />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Actual"   Width="100"  >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <my:Label  Content="{Binding Actual}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="TargetScore" Width="100" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel  Loaded ="SPlevel1TargetScore_Loaded" Orientation="Horizontal" Background="Transparent">
                                <TextBlock Text="{Binding Target}" TextWrapping="NoWrap"   HorizontalAlignment ="Left" Margin="10,0,10,0" Width="25" Foreground="Blue"  ></TextBlock>
                                <Image x:Name ="imgTargetScore" Source ="{Binding TargetColor}" Stretch ="None"  />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="TargetScore"   Width="100" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Loaded ="SPlevel1TrendScore_Loaded" Orientation="Horizontal" Background="Transparent" >
                                <TextBlock Text="{Binding TrendScore}" TextWrapping="NoWrap" HorizontalAlignment ="Left" Margin="10,0,10,0"  Width="25" Foreground="Blue" ></TextBlock>
                                <Image  x:Name="imgTrendScore"  Stretch="None"
                  Source ="{Binding TrendArrow}"  />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate >
                    <StackPanel DataContext="{x:Null}">
                        <telerik:RadGridView  x:Name="RadGrid2"  ShowGroupPanel="False"  RowIndicatorVisibility="Collapsed"  BorderThickness="0"
                                                    CanUserInsertRows="False"    RowDetailsVisibilityMode="Collapsed"  
                                                    AutoGenerateColumns="False"   
                                                    CanUserFreezeColumns="False"   
                                                    CanUserReorderColumns="False"
                                                     Width="Auto"  Height="Auto"  Background="#FFC6C6C6"
                                                    ShowColumnHeaders="False"    RowDetailsVisibilityChanged="RadGrid2_RowDetailsVisibilityChanged"
                                                     >
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn>
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel   Orientation="Horizontal" >
                                                <my:Label Content=" " Background="#3F9ADFF3" Width="24"  BorderThickness="0"/>
                                                <Button x:Name="myButton" Width="24" HorizontalAlignment="Right"   Visibility="{Binding Is_Leaf, Converter={StaticResource LevelToVisibility}}"
                            Click="ExpandLevel2_Click" >
                                                    <!--<Image  x:Name="imgLevel2" Source="Images/left_side.png" Stretch="None"
                Visibility="{Binding Is_Leaf, Converter={StaticResource LevelToVisibility}}"  />-->
                                                </Button>
                                            </StackPanel>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding UniqueName}"  IsVisible="False" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}"  IsVisible="False" />
                                <telerik:GridViewDataColumn Header="KPI"  Width="*" >
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <my:Label  Content="{Binding KPI}" />
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Actual" Width="100"  >
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <my:Label  Content="{Binding Actual}" />
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="TargetScore" Width="100">
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel  Loaded ="SPlevel2TargetScore_Loaded" Orientation="Horizontal" Background="Transparent">
                                                <TextBlock Text="{Binding Target}" TextWrapping="NoWrap"   HorizontalAlignment ="Left" Margin="10,0,10,0" Width="25" Foreground="Blue"  ></TextBlock>
                                                <Image x:Name ="imgTargetScore" Source ="{Binding TargetColor}" Stretch ="None"  />
                                            </StackPanel>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="TrendScore"  Width="100">
                                    <telerik:GridViewDataColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Loaded ="SPlevel2TrendScore_Loaded" Orientation="Horizontal" Background="Transparent" >
                                                <TextBlock Text="{Binding TrendScore}" TextWrapping="NoWrap" HorizontalAlignment ="Left" Margin="10,0,10,0"  Width="25" Foreground="Blue" ></TextBlock>
                                                <Image  x:Name="imgTrendScore"  Stretch="None"
                  Source ="{Binding TrendArrow}"  />
                                            </StackPanel>
                                        </DataTemplate>
                                    </telerik:GridViewDataColumn.CellTemplate>
                                </telerik:GridViewDataColumn>
                            </telerik:RadGridView.Columns>
                        </telerik:RadGridView>
                    </StackPanel>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>
        </telerik:RadGridView>

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 May 2010, 10:13 AM
Hi kumar p,

Please prepare a sample runnable project that reproduces this behavior, open a separate support ticket and attach it. We will then take a look at it.

All the best,
Ross
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
kumar p
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or