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

Display datagridviewDataColumn dynamically

3 Answers 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GOURVEZ JJ
Top achievements
Rank 1
GOURVEZ JJ asked on 05 Jan 2012, 04:06 PM
Hello,

I use 2 RadGridView (like First look example)
But I want display dynamically datagridviewDataColumns in the second RadGridView.
I use RowLoaded event to display column, but when I clicked on GridViewToggleRowDetailsColumn, is slow (3 minutes to 200 rows in my second GridView)

Can you help me ?

This is my code :
<telerik:RadGridView x:Name="RadGridView1" ScrollMode="Deferred" Drop="dropGridView1" AllowDrop="True" Margin="1,87,2,0"  RowIndicatorVisibility="Collapsed" IsReadOnly="True" RowHeight="30" AutoGenerateColumns="False" CanUserFreezeColumns="False"  ShowGroupPanel="False" BorderBrush="Beige"  SelectionChanged="cliRadGridView" Foreground="Black" GroupPanelForeground="#FFC79FDA" Style="{StaticResource RadGridViewStyle1}" Visibility="Collapsed">
                               <telerik:RadGridView.Columns>
                                   <telerik:GridViewToggleRowDetailsColumn HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
 
                                   <telerik:GridViewImageColumn Header="" DataMemberBinding="{Binding type}" ImageHeight="35" ImageWidth="35" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"></telerik:GridViewImageColumn>
 
 
                               </telerik:RadGridView.Columns>
                            
                            
 
                               <telerik:RadGridView.RowDetailsTemplate>
                                   <DataTemplate>
                                       <telerik:RadGridView x:Name="RadGridView2" AllowDrop="True" Drop="clubsGrid_Drop" MinHeight="300" ScrollMode="Deferred" Margin="10" RowLoaded="chargementLigneRadGridView2"  ItemsSource="{Binding listeClass}"  RowIndicatorVisibility="Collapsed" IsReadOnly="True" RowHeight="45" AutoGenerateColumns="False" CanUserFreezeColumns="False" ShowGroupPanel="True" BorderBrush="Beige"  SelectionChanged="cliRadGridView" Foreground="Black" GroupPanelForeground="#FFC79FDA" Style="{StaticResource RadGridViewStyle1}" MouseRightButtonDown="clicDroitGridView1Down" MouseRightButtonUp="clicDroitGridView1Up" local:ContextMenuBehaviorRecherche.ContextMenu="{Binding ElementName=GridContextMenu}">
                                           <telerikNavigation:RadContextMenu.ContextMenu>
                                               <telerikNavigation:RadContextMenu x:Name="GridContextMenu">
                                                   <telerikNavigation:RadMenuItem Header="Ouvrir ce document">
                                                       <telerikNavigation:RadMenuItem.IconTemplate>
                                                           <DataTemplate>
                                                               <Image Source="img/picto_ouvrir.png"/>
                                                           </DataTemplate>
                                                       </telerikNavigation:RadMenuItem.IconTemplate>
                                                   </telerikNavigation:RadMenuItem>
                                                   <telerikNavigation:RadMenuItem Header="Editer">
                                                       <telerikNavigation:RadMenuItem.IconTemplate>
                                                           <DataTemplate>
                                                               <Image Source="img/picto_generer.png"/>
                                                           </DataTemplate>
                                                       </telerikNavigation:RadMenuItem.IconTemplate>
                                                   </telerikNavigation:RadMenuItem>
                                                   <telerikNavigation:RadMenuItem Header="Envoyer le document par mail">
                                                       <telerikNavigation:RadMenuItem.IconTemplate>
                                                           <DataTemplate>
                                                               <Image Source="img/mail.png"/>
                                                           </DataTemplate>
                                                       </telerikNavigation:RadMenuItem.IconTemplate>
                                                   </telerikNavigation:RadMenuItem>
                                                   <telerikNavigation:RadMenuItem Header="Envoyer le document par fax">
                                                       <telerikNavigation:RadMenuItem.IconTemplate>
                                                           <DataTemplate>
                                                               <Image Source="img/fax.png"/>
                                                           </DataTemplate>
                                                       </telerikNavigation:RadMenuItem.IconTemplate>
                                                   </telerikNavigation:RadMenuItem>
                                                   <telerikNavigation:RadMenuItem Header="Gestion des notes">
                                                       <telerikNavigation:RadMenuItem.IconTemplate>
                                                           <DataTemplate>
                                                               <Image Source="img/picto_details.png"/>
                                                           </DataTemplate>
                                                       </telerikNavigation:RadMenuItem.IconTemplate>
                                                   </telerikNavigation:RadMenuItem>
                                                   <telerikNavigation:RadMenuItem Header="Gestion des pièces jointes">
                                                       <telerikNavigation:RadMenuItem.IconTemplate>
                                                           <DataTemplate>
                                                               <Image Source="img/trombone.png"/>
                                                           </DataTemplate>
                                                       </telerikNavigation:RadMenuItem.IconTemplate>
                                                   </telerikNavigation:RadMenuItem>
 
                                                   <telerikNavigation:RadMenuItem Header="Supprimer">
                                                       <telerikNavigation:RadMenuItem.IconTemplate>
                                                           <DataTemplate>
                                                               <Image Source="img/delete.png"/>
                                                           </DataTemplate>
                                                       </telerikNavigation:RadMenuItem.IconTemplate>
                                                   </telerikNavigation:RadMenuItem>
 
                                                   <telerikNavigation:RadMenuItem Header="Propriété"/>
 
                                                   <telerikNavigation:RadMenuItem Header="Transformer en bon de commande"/>
 
                                               </telerikNavigation:RadContextMenu>
                                           </telerikNavigation:RadContextMenu.ContextMenu>
                                           <telerik:RadGridView.Columns>
                                               <telerik:GridViewToggleRowDetailsColumn HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewImageColumn Header="" DataMemberBinding="{Binding typeDoc}" ImageHeight="25" ImageWidth="25" IsVisible="True"   HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewDataColumn Header="Type" DataMemberBinding="{Binding Critere}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
 
                                               <!-- Information sur les types de document bureautique + image -->
                                               <telerik:GridViewDataColumn Header="Nom du document" DataMemberBinding="{Binding nomFichier}" MinWidth="100" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Chemin" DataMemberBinding="{Binding chemin}" MinWidth="100" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}">
                                                   <telerik:GridViewDataColumn.ToolTipTemplate>
                                                       <DataTemplate>
                                                           <dataInput:Label Content="{Binding chemin}"/>
                                                       </DataTemplate>
                                                   </telerik:GridViewDataColumn.ToolTipTemplate>
                                               </telerik:GridViewDataColumn>
 
                                               <telerik:GridViewDataColumn Header="Date" DataMemberBinding="{Binding dateCreation}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewDataColumn Header="Auteur" DataMemberBinding="{Binding auteur}" MinWidth="100" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewDataColumn Header="Version" DataMemberBinding="{Binding version}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
 
                                               <!-- Information sur les types de document mail -->
                                               <telerik:GridViewDataColumn Header="De" DataMemberBinding="{Binding auteur}" MinWidth="150" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewDataColumn Header="A" DataMemberBinding="{Binding informationMailA}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewDataColumn Header="CC" DataMemberBinding="{Binding informationMailCC}" MinWidth="100" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewDataColumn Header="Objet" DataMemberBinding="{Binding nomFichier}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
                                               <telerik:GridViewDataColumn Header="Date" DataMemberBinding="{Binding dateCreation}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"/>
 
                                               <!-- Information sur les types de document Sage -->
                                               <telerik:GridViewDataColumn Header="N° Piece" DataMemberBinding="{Binding nomFichier}" MinWidth="90" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}"  />
                                               <telerik:GridViewDataColumn Header="Tiers" DataMemberBinding="{Binding nom}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Statut" DataMemberBinding="{Binding statut}" MinWidth="100" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Date doc" DataMemberBinding="{Binding date}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Montant" DataMemberBinding="{Binding montant}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Référence" DataMemberBinding="{Binding reference}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Date de livraison" DataMemberBinding="{Binding dateLivraison}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Réglement" DataMemberBinding="{Binding reglement}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
                                               <telerik:GridViewDataColumn Header="Représentant" DataMemberBinding="{Binding representant}" IsVisible="False" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle1}" />
 
                                           </telerik:RadGridView.Columns>
 
                                           <telerik:RadGridView.RowDetailsTemplate>
                                               <DataTemplate>
                                                   <telerikNavigation:RadTabControl x:Name="RadTabControl1" HorizontalAlignment="Left" Margin="8" VerticalAlignment="Center" BackgroundVisibility="Visible" MinWidth="600">
 
                                                       <telerikNavigation:RadTabItem Header="Preview" DataContext="{Binding}" Margin="10,0,0,0" Height="24" Visibility="Collapsed" />
 
                                                       <telerikNavigation:RadTabItem Header="Preview" DataContext="{Binding}" Margin="10,0,0,0" Height="24" Visibility="{Binding afficherPreviewdoc}" IsSelected="{Binding afficheFirstColonnePreviewDoc}">
                                                           <WebBrowser x:Name="webBrowserPrev" Source="{Binding adresseFichierComplet}" MinHeight="300" MinWidth="450"  />
 
                                                       </telerikNavigation:RadTabItem>
 
                                                       <telerikNavigation:RadTabItem Header="Entete" DataContext="{Binding}" Margin="10,0,0,0" Height="24" Visibility="{Binding afficherEnteteSage}" IsSelected="{Binding afficheFirstColonnePreviewsage}">
                                                           <local:fenEnteteSageTelerik/>
                                                       </telerikNavigation:RadTabItem>
 
                                                       <telerikNavigation:RadTabItem Header="Detail" DataContext="{Binding}" Margin="10,0,0,0" Height="24" Visibility="{Binding afficherDetailSage}" >
                                                           <local:fenDetailSageTelerik/>
 
                                                       </telerikNavigation:RadTabItem>
 
 
 
                                                       <telerikNavigation:RadTabItem Header="Note" DataContext="{Binding}" Margin="10,0,0,0" Height="24">
                                                           <local:fenNoteViewTelerik/>
                                                       </telerikNavigation:RadTabItem>
                                                       <telerikNavigation:RadTabItem Header="Pièce jointe" DataContext="{Binding}" Margin="10,0,0,0" Height="24">
                                                           <local:fenPJViewTelerik/>
                                                       </telerikNavigation:RadTabItem>
                                                       <telerikNavigation:RadTabItem Header="Description" DataContext="{Binding}" Visibility="{Binding afficherDescription}" Margin="10,0,0,0" Height="24">
                                                           <local:fenDescriptionViewTelerik/>
 
                                                       </telerikNavigation:RadTabItem>
                                                       <telerikNavigation:RadTabItem Header="Mots-clefs" DataContext="{Binding}" Margin="10,0,0,0" Height="24" Visibility="{Binding afficherMotCle}" >
                                                           <local:fenMotCleViewTelerik/>
                                                       </telerikNavigation:RadTabItem>
 
 
 
                                                   </telerikNavigation:RadTabControl>
                                               </DataTemplate>
                                           </telerik:RadGridView.RowDetailsTemplate>
 
                                       </telerik:RadGridView>
                                   </DataTemplate>
                               </telerik:RadGridView.RowDetailsTemplate>
 
                           </telerik:RadGridView>


Thanks

3 Answers, 1 is accepted

Sort by
0
GOURVEZ JJ
Top achievements
Rank 1
answered on 05 Jan 2012, 06:12 PM
Nobody ?
0
Vlad
Telerik team
answered on 06 Jan 2012, 09:13 AM
Hi,

 Maybe you should set MaxHeight="300" instead MinHeight="300" since all control inside row details by default are measured with infinity height. 

Kind regards,
Vlad
the Telerik team

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

0
GOURVEZ JJ
Top achievements
Rank 1
answered on 06 Jan 2012, 09:39 AM
Hi Vlad, thanks for your answer.

I replaced minHeight to maxheight, and the problem it's resolved.

Thanks !!!
Tags
GridView
Asked by
GOURVEZ JJ
Top achievements
Rank 1
Answers by
GOURVEZ JJ
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or