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

[Solved] RowDetailTemplate not getting expanded through CS code

1 Answer 108 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mohan choudhary
Top achievements
Rank 1
mohan choudhary asked on 18 Dec 2009, 11:33 AM
My RowDetailsTemplate contains a RadGridView, when ever a row is added by my viewModel into the _CalendarDateList RadGridView
the RowDetailsTemplate should be in expanded mode showing the newly added row in RadGridView

 <telerikData:RadGridView.RowDetailsTemplate> 
                <DataTemplate> 
                    <StackPanel Background="#ffe8e7e3"
                       <Border Margin="33, 0, 0, 0" BorderBrush="Transparent" BorderThickness="0"
                            <telerikData:RadGridView Name="_CalendarDateList" ShowGroupPanel="False" 
                                telerikGridViewFilter:GridViewFilterRow.IsEnabled="True" BorderThickness="2" BorderBrush="#A6A6A6" 
                                 ItemsSource="{Binding CalendarDateData}"  SelectionMode="Single" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" AutoGenerateColumns="False"  
                                 CanUserResizeColumns="False" CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" Background="White"

for that I have implemented the following code -
 private void calendarViewModel_AddIndividualCalendarCalendarDateCompleted(object sender, EventArgs e) 
        { 
            _CalendarViewModel.AddIndividualCalendarCalendarDateCompleted -= new EventHandler<EventArgs>(calendarViewModel_AddIndividualCalendarCalendarDateCompleted); 
 
            CalendarModel calModel = sender as CalendarModel; 
            if (calModel != null
            { 
                GridViewRow row = _CalendarList.ItemContainerGenerator.ContainerFromItem(calModel) as GridViewRow; 
                if (row != null) row.DetailsVisibility = Visibility.Visible; 
            } 
        } 

But It is not getting expanded, am I missing something in the RowDetailsTemplate in XAML or somewhere else?  I have debugged my entire code and it sets the DetailsVisibility to Visible but still it is not getting expanded.

I also tried with another alternate solution, i.e. by retrieving the row through following looping -
 private void calendarViewModel_AddIndividualCalendarCalendarDateCompleted(object sender, EventArgs e) 
        { 
            _CalendarViewModel.AddIndividualCalendarCalendarDateCompleted -= new EventHandler<EventArgs>(calendarViewModel_AddIndividualCalendarCalendarDateCompleted); 
 
            CalendarModel calModel = sender as CalendarModel; 
            if (calModel != null
            { 
 
                IList<GridViewRow> gridViewRows = this._CalendarList.ChildrenOfType<GridViewRow>(); 
 
                foreach (GridViewRow gvr in gridViewRows) 
                { 
                    CalendarModel calendarModelTemp = gvr.DataContext as CalendarModel; 
 
                    if (calendarModelTemp != null 
                        && calModel != null 
                        && calendarModelTemp.BusinessCalendarData.Id == calModel.BusinessCalendarData.Id) 
                    { 
                        gvr.DetailsVisibility = Visibility.Visible; 
                        break
                    } 
                }                
            } 
        } 

Still the RowDetailsTemplate is not getting expanded.






1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 18 Dec 2009, 11:41 AM
Hi mohan choudhary,

We have tried to reproduce what you have described but it is working on our end.

Can you send us a runnable sample project with dummy data that demonstrates this behavior and we will debug it. Also, tell us the exact steps we need to undertake in order to reproduce the issue you are faced with.

Kind regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
mohan choudhary
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or