RadGrid with 5000px height inside the radexpander

2 posts, 0 answers
  1. Paolo
    Paolo avatar
    423 posts
    Member since:
    Jun 2009

    Posted 27 Feb 2014 Link to this post

    Hello,
    I've got a view that's composed of this code

    <if:IFPage x:Class="xxx.Views.Derivati.RichiesteDiEsercizio"
        xmlns:if="clr-namespace:xxx"    
        xmlns:local="clr-namespace:xxx.Controls.Search"
        mc:Ignorable="d"             >
        <telerik:RadBusyIndicator x:Name="busyIndicator">
            <StackPanel x:Name="spHeader" Orientation="Vertical" Margin="3,3,0,0" VerticalAlignment="Stretch">
                <telerik:RadExpander Header="Inserimento">
                    <telerik:RadExpander.Content>
                        <StackPanel Orientation="Horizontal">
                            <local:RapportoUC x:Name="ucRapporto" Margin="5,0,0,0"></local:RapportoUC>
                            <TextBlock Text="Data Inserimento" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,0,0" ></TextBlock>
                            <telerik:RadDatePicker x:Name="dtInser" Width="120" SelectableDateStart="2010/07/31" DisplayDateStart="2010/07/31" IsReadOnly="True" >
                            </telerik:RadDatePicker>
                            <Button x:Name="btnInserisci" Content="Inserisci" Margin="5,0,0,0" Click="btnInserisci_Click" ></Button>
                        </StackPanel>
                    </telerik:RadExpander.Content>
                </telerik:RadExpander>
                <telerik:RadExpander x:Name="spVisualizza" Header="Visualizza" VirtualizingStackPanel.VirtualizationMode="Standard">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25"></RowDefinition>
                            <RowDefinition Height="*"></RowDefinition>
                        </Grid.RowDefinitions>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Data" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,0,0" ></TextBlock>
                            <telerik:RadDatePicker x:Name="dtPicker" Width="120" SelectableDateStart="2010/07/31" DisplayDateStart="2010/07/31"  >
                            </telerik:RadDatePicker>
                            <Button x:Name="btnCarica" Content="Visualizza" Margin="5,0,0,0" Click="btnCarica_Click" ></Button>
                        </StackPanel>
                        <telerik:RadGridView x:Name="DataItems" Grid.Row="1" AutoGenerateColumns="False" CanUserInsertRows="False" ScrollViewer.VerticalScrollBarVisibility="Visible" SizeChanged="DataItems_SizeChanged"
                                     AlternateRowBackground="LightBlue"  IsReadOnly="True">
                            <telerik:RadContextMenu.ContextMenu>
                                <telerik:RadContextMenu x:Name="ContextMenu" Opening="ContextMenu_Opening" ItemClick="RadMenuItem_Click">
                                    <telerik:RadMenuItem Header="Disattiva Richiesta" Tag="disattiva_richiesta"  />
                                </telerik:RadContextMenu>
                            </telerik:RadContextMenu.ContextMenu>
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn Header="NDG" UniqueName="Ndg" DataMemberBinding="{Binding Ndg}" >
                                    <telerik:GridViewDataColumn.AggregateFunctions>
                                        <telerik:CountFunction Caption="Totale righe: " />
                                    </telerik:GridViewDataColumn.AggregateFunctions>
                                </telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Intestazione" UniqueName="Intestazione" DataMemberBinding="{Binding Intestazione}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Dossier" UniqueName="Dossier" DataMemberBinding="{Binding Dossier}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Filiale" UniqueName="Filiale" DataMemberBinding="{Binding Filiale}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="RM" UniqueName="Rm" DataMemberBinding="{Binding Rm}" ></telerik:GridViewDataColumn>
                                <!--<telerik:GridViewDataColumn Header="NaturaGiuridica" UniqueName="NaturaGiuridica" DataMemberBinding="{Binding NaturaGiuridica}" ></telerik:GridViewDataColumn>-->
                                <telerik:GridViewDataColumn Header="DescrizioneStrumento" UniqueName="DescrizioneStrumento" DataMemberBinding="{Binding DescrizioneStrumento}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Mercato" UniqueName="Mercato" DataMemberBinding="{Binding Mercato}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Divisa" UniqueName="Divisa" DataMemberBinding="{Binding Divisa}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Size" UniqueName="Size" DataMemberBinding="{Binding Size}" TextAlignment="Right" DataFormatString="N2" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Strike" UniqueName="Strike" DataMemberBinding="{Binding Strike}" DataFormatString="N2" TextAlignment="Right" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Diritto" UniqueName="Diritto" DataMemberBinding="{Binding Diritto}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Quantità" UniqueName="Qta" DataMemberBinding="{Binding Qta}" TextAlignment="Right" DataFormatString="N2"></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="CTV" UniqueName="Ctv" DataMemberBinding="{Binding Ctv}" DataFormatString="N2" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Scadenza" UniqueName="Scadenza" DataMemberBinding="{Binding Scadenza}" DataFormatString="{}{0:dd/MM/yyyy}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn Header="Tipo" UniqueName="Tipo" DataMemberBinding="{Binding Tipo}" ></telerik:GridViewDataColumn>
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding ModalitaRicezione}" Header="Modalità Ricezione" UniqueName="MODALITA_RICEZIONE" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Note}" Header="Note" UniqueName="NOTE" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Stato}" Header="Stato" UniqueName="STATO" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding UtenteRichiesta}" Header="Utente Richiesta" UniqueName="UTENTE_RICHIESTA" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding DtTsInserimento}" Header="Data Inserimento" UniqueName="DT_TS_INSERIMENTO"  DataFormatString="{}{0:dd/MM/yyyy}" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding ErrorMsg}" Header="Error Msg." UniqueName="ERROR_MSG" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding DtTsPresoInCarico}" Header="Data Preso in carico" UniqueName="DT_TS_PRESO_IN_CARICO"  DataFormatString="{}{0:dd/MM/yyyy}" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding DtTsChiuso}" Header="TS Chiuso" UniqueName="DT_TS_CHIUSO" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding UtenteCancellazione}" Header="Utente Cancellazione" UniqueName="UTENTE_CANCELLAZIONE" />
                            </telerik:RadGridView.Columns>
                        </telerik:RadGridView>
                    </Grid>
                </telerik:RadExpander>
            </StackPanel>
        </telerik:RadBusyIndicator>
    </if:IFPage>

    When the RadGrid inside the spVisualizza has a a lot of data the scrollviewer doesn't appear...I've used the SizeChanged on the radgridview and I've seen it has a height of 5000+ px.... I don't understand how to set height in order to have it sized to monitor resolution without setting a fixed number...any suggestion? I've trid to set the second grid' height to * , Auto, nothing...but nothing changed...
    Thanks in advance
  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 28 Feb 2014 Link to this post

    Hi Paolo,

    The issue is caused by the parent StackPanel with x:Name "spHeader" which measures its children with infinity and does not restrict their size. If you want to resolve it without setting fixed height you will need to replace the StackPanel with another Panel. For example, you can use a Grid with two rows which should fit well in your scenario.
    <Grid x:Name="gridHeader" Margin="3 3 0 0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        .....
    </Grid>

    I also attached a sample project with the provided XAML. Please let us know if this is helpful for you.

    Regards,
    Martin
    Telerik
  3. DevCraft banner
Back to Top