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

[Solved] Hierarchy Question

5 Answers 314 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.
bill
Top achievements
Rank 1
bill asked on 16 Mar 2009, 01:57 AM
I've noticed that in the RadGridView I can show master-detail data tables.  And when the relationship is defined the "+" sign automatically appears to let you drill down to see the child table.  Now, is it possible to show some detail data where there might not necessarily be another child table?  So in that case you just want to show some extra data details that are not necessarily another child table.  So for example if I have a customer collection with each customer having a name, phone, address, city, state, and brief_description.  In that case I might only want to show the customer name, phone, city, state in the grid ... but then allow the user to drill down "similar to the master-detail example" .. but in this case there is not necessarily any child table, in this case when the user clicks on the "+" i would like to just show the customer's  Address and Brief_description fields.  I can do this with the Microsoft basic Grid but I have not seen an example of how to do this with RadGridView other than in the cases where you have hierarchical tables .... Please send an example or brief explanation of what would go in the XAML and any C# code to achieve this.  When I tried to do this, I did not manage to get the "+" to show on any of the records.

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Mar 2009, 06:49 AM
Hi bill,

Please check these examples for more info:
http://demos.telerik.com/silverlight/default.aspx#GridView/FirstLook
http://demos.telerik.com/silverlight/default.aspx#GridView/RowPreview


Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jeff
Top achievements
Rank 1
answered on 21 Apr 2009, 03:43 AM
Hi Vlad,

We are going to need something like what you are doing in the FirstLook example (with the embedded tab control).  It seems like the expander icon is showing for every row because every row (in your demo) has hierarchical data - correct?  In our case, we would want it to show always so that for rows that don't contain heirarchical data we could still show detail data l(ike in the row preview demo).  Any way to do that programatically?  I'm also having difficulty figuring out what the purpose of the dictionary was/is in the demo.

Also, the animation effects done in the row preview are very nice and we would want to incorporate that as well, so it seems we need a mix of the two approaches.  Before we jump off the cliff, we would appreciate any thoughts or suggestions about how to proceed .

Last but not least...I tried to run the samples from the latest release but VS wants to upgrade them which did not convert correctly.  I have my machine setup for doing SL3 development.

Thanks,
Jeff

0
Hristo Deshev
Telerik team
answered on 24 Apr 2009, 01:28 PM
Hi Jeff,

I've prepared an example that might do what you are after. I started with the Row Preview example and:
  1. Made it look like a hierarchical grid by making expanded rows stay expanded (until explicitly collapsed)
  2. Added a button that would expand/collapse the rows and removed the logic that did it on row clicks.
  3. Bound the "expander" Opacity property to a property of the view model that would hide the control if the employee has no orders.
I am attaching the project to this thread.

Kind regards,
Hristo Deshev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
David
Top achievements
Rank 1
answered on 15 Jun 2009, 02:10 PM
Hi,

i followed ur example which works great only problem is that when u look at the column headers and the rows the rows are being pushed to the right the width of the button is there any way round this???

David
0
Hristo Deshev
Telerik team
answered on 16 Jun 2009, 08:40 AM
Hello David,

Yes, that is possible, but I avoided it on purpose. If you add the toggle button in a column cell template that is used for something else, you will get a jagged look because some of the cells won't have the toggle button displayed. See the attached screenshot.

If you really wish to go that way, remove the first column, and move the toggle button to the next column's cell template. Here's how my cell template looks like:

<ControlTemplate TargetType="grid:GridViewCell"
    <Border BorderThickness="0,0,0,1" BorderBrush="#FFB3B3B3"
        <Grid> 
            <Grid.ColumnDefinitions> 
                <ColumnDefinition Width="Auto"></ColumnDefinition> 
                <ColumnDefinition Width="38"></ColumnDefinition> 
                <ColumnDefinition></ColumnDefinition
            </Grid.ColumnDefinitions> 
            <Button Name="previewToggle"   
                    VerticalAlignment="Center"   
                    Width="23"  
                    Height="23"  
                    Content="X"  
                    Click="previewToggle_Click"  
                    Grid.Column="0" 
                    Visibility="{Binding OrdersVisibility}"
            </Button> 
            <Border Grid.Column="1"  Margin="4" BorderThickness="1,1,1,1"  
                    CornerRadius="3"  
                    Background="#FFFFFFFF"  
                    HorizontalAlignment="Left"  
                    VerticalAlignment="Bottom" Width="38" Height="38"
                <Border.BorderBrush> 
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"
                        <GradientStop Color="#FF2F2F2F" Offset="1"/> 
                        <GradientStop Color="#FF515151" Offset="0.008"/> 
                    </LinearGradientBrush> 
                </Border.BorderBrush> 
                <Image Source="{Binding Photo}" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" Height="33.112" Width="33.112" /> 
            </Border> 
            <Rectangle Grid.Column="2"  
                       Width="{TemplateBinding VerticalLineThickness}"  
                       Fill="{TemplateBinding VerticalLineFill}"  
                       HorizontalAlignment="Right"  
                        Visibility="{TemplateBinding VerticalLineVisibility}" /> 
        </Grid> 
    </Border> 
</ControlTemplate> 


All the best,
Hristo Deshev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
bill
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jeff
Top achievements
Rank 1
Hristo Deshev
Telerik team
David
Top achievements
Rank 1
Share this question
or