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

adding multiple RadGridView and RadGridPager to same page

1 Answer 166 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Brian Graves
Top achievements
Rank 1
Brian Graves asked on 08 Jun 2010, 01:28 AM
I'm trying to render a page than has multiple grid views in it.  Since, at runtime, I don't know how many views I have to show, I removed the RadGridView and RadGridPager elements from my MainPage.xaml file and generate them with the following code:

                //for each data view to add
                //{
                    RadGridView rgv = new RadGridView();
                    rgv.CanUserFreezeColumns = true;
                    rgv.CanUserResizeColumns = true;
                    rgv.IsReadOnly = true;
                    //rgv.Sorting (how do I set this to my handler?)
                    rgv.ShowColumnFooters = true;
                    rgv.AutoExpandGroups = false;
                    //rgv.GroupRowStyle (how do I set this to "{StaticResource MyCustomGroupRowStyle}"?)
                    rgv.ShowGroupFooters = true;
                    rgv.CanUserSelect = true;
                    rgv.SelectionMode = System.Windows.Controls.SelectionMode.Extended;

                    LayoutRoot.Children.Add(rgv);

                    RadDataPager rdp = new RadDataPager();
                    rdp.PageSize = 20;
                    rdp.DisplayMode = PagerDisplayModes.All;
                    rdp.AutoEllipsisMode = AutoEllipsisModes.Both;
                    rdp.NumericButtonCount = 10;
                    rdp.IsTotalItemCountFixed = true;
                    rdp.Source = rgv.Items;

                    LayoutRoot.Children.Add(rdp);

                    rgv = AddColumns(rgv);
                    rgv.ItemsSource = _datalist;

                //}



Even with only 1 view/pager that is showing the correct data, my elements are overlapping.  First, my grid view totally overlaps my xaml export StackPanel element (effectively hiding it).  Then, my pager overlaps my grid (in the middle of the grid).  My first question is:  why is overlapping occurring instead of one element appearing after the other?

The second question is: how do I add Interaction Behaviors in this code for my grid view?  Specifically, this one that telerik told me to use to show that the grid is still loading:
<i:Interaction.Behaviors>
                <local:EmptyDataTemplateBehavior>
                    <local:EmptyDataTemplateBehavior.EmptyDataTemplate>
                        <DataTemplate>
                            <TextBlock Text="Please wait while report is loading..." Foreground="Black" HorizontalAlignment="Center"  VerticalAlignment="Center" Visibility="{Binding MessageVisibility}" />
                        </DataTemplate>
                    </local:EmptyDataTemplateBehavior.EmptyDataTemplate>
                </local:EmptyDataTemplateBehavior>
            </i:Interaction.Behaviors>

Finally, how do I programmatically set the ShowHeaderAggregate property (this was being done in the xaml) to False in each grid view?

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 08 Jun 2010, 12:46 PM
Hello Brian Graves,

On the first question :
I believe the 'LayoutRoot' element in your case is a Grid, so it is expected behavior to see overlapped the UIElements added to it.

In case  you need the elements in a specific layout you should either use another container ( such as e.g. StackPanel ) , or you need to add row/column definitions to the LayoutRoot grid and place elements accordingly.
On your second question :
here you may find how to attach a behavior in code :
http://geekswithblogs.net/SilverBlog/archive/2009/09/22/behaviors-how-to-attach-behavior-in-code-behind-silverlight-3.aspx

On the third question:
Please paste me the previous XAML ( the one setting the property ) and I will write for you the c#  replacement for it .

Kind regards,
Pavel Pavlov
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
Brian Graves
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or