Rows Height

10 posts, 0 answers
  1. Andrea Marchetti
    Andrea  Marchetti avatar
    16 posts
    Member since:
    Jul 2005

    Posted 20 May 2010 Link to this post

    I need to create a grid with very near and very small rows.
    I have succeeded in reducing the height of the rows. I don't succeed in systematizing the alignment of the content. The lines are truncated me. Can you help me?

    Thanks

    Code :

     <UserControl.Resources>
      <Style x:Key="GridViewRowStyle1" TargetType="{x:Type telerik:GridViewRow}">
       <Setter Property="Height" Value="15"/>
       <Setter Property="MinHeight" Value="15"/>
       <Setter Property="VerticalAlignment" Value="Top"/>
      </Style>

     </UserControl.Resources>
       ....
                <telerik:RadGridView x:Name="GridViewAnaClienti" IsReadOnly="True"  Grid.Row="2" BorderThickness="1" FontSize="9"
                        RowStyle="{StaticResource GridViewRowStyle1}" >
        <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn Header="Codice" Width="80" DataMemberBinding="{Binding Codice}"  />
                        <telerik:GridViewDataColumn Header="Ragione Sociale" MinWidth="280" DataMemberBinding="{Binding RagioneSociale}"/>
                        <telerik:GridViewDataColumn Header="Indirizzo" MinWidth="270" DataMemberBinding="{Binding Indirizzo1}"/>
       ...
                    </telerik:RadGridView.Columns>
       </telerik:RadGridView> 
       ...
     </UserControl>


    attached file: example of the result

  2. Kalin Milanov
    Admin
    Kalin Milanov avatar
    447 posts

    Posted 20 May 2010 Link to this post

    Hello Andrea Marchetti,

    This issue has already been addressed and is available in our latest internal build. You can update to this version and use the RowHeight property of the RadGridView to set the row height. There is no need to set styles and templates to achieve that anymore.

    Regards,
    Kalin Milanov
    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Sergey
    Sergey avatar
    9 posts
    Member since:
    Sep 2016

    Posted 13 Sep Link to this post

    RowHeight property doesn't affect rows if ExpressionDark theme is used, and some other themes also have this issue
  5. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    368 posts

    Posted 13 Sep Link to this post

    Hello Sergey,

    I'm attaching a sample project where the RowHeight property is respected in both parent and child RadGridView instances. Could you please have a look at it and let me know whether I've missed something of importance?

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Sergey
    Sergey avatar
    9 posts
    Member since:
    Sep 2016

    Posted 14 Sep Link to this post

    Hi, yes, there is no issues in your sample, but I have made some modifications:

    - Added dynamic theme changing (still no issues)

    - Added 'lightweght' styles - to improve performance, they are described in documentation of RadGridView in "How to.." chapter.

    Then I have issues after theme switching - see attached modified sample.

    I found a way and fixed this issues too, but then I have a described problem with RowHeight.

    P.S.:

    I cannot attach zip sample, because of restrictions, so I can only attach a screenshots

  7. Sergey
    Sergey avatar
    9 posts
    Member since:
    Sep 2016

    Posted 14 Sep Link to this post

    Here is a description of Lightweight templates:

    http://www.telerik.com/blogs/how-to-boost-radgridview-performance-for-wpf-and-silverlight-using-lightweight-templates

     

  8. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    368 posts

    Posted 14 Sep Link to this post

    Hello Sergey,

    The reason you're observing this behavior is because you're basing your styles on static resources which do not get updated when you switch the themes. This can be overcome by adding the following lines to your ApplyTheme method right after you've added the resource dictionaries to the MergedDictionaries collection:

    Application.Current.Resources[typeof(GridViewRow)] = new Style(typeof(GridViewRow)) { BasedOn = (Style)Application.Current.Resources["GridViewRowCoreStyle"] };
                Application.Current.Resources[typeof(TreeListViewRow)] = new Style(typeof(TreeListViewRow)) { BasedOn = (Style)Application.Current.Resources["TreeListViewRowCoreStyle"] };
                Application.Current.Resources[typeof(GridViewCell)] = new Style(typeof(GridViewCell)) { BasedOn = (Style)Application.Current.Resources["GridViewCellCoreStyle"] };

    I'm also attaching a sample project to demonstrate the approach I have in mind. Please let me know if this works for you.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  9. Sergey
    Sergey avatar
    9 posts
    Member since:
    Sep 2016

    Posted 14 Sep Link to this post

    Hi, thank you for reply,

    yes, this works fine, but let me show an issue with RowHeight in your sample project:

    Let set RowHeight="20" instead of RowHeight="60"

    Some themes (and expression dark) does not apply the value "20",

       but apply if you remove lightweight templates, see screenshot.

    Windows8Touch theme apply value "20" in all templates, but not apply in edit mode, see screenshot;

    In my application I expect if I set RowHeight="20" then it should be 20 in all themes and modes; 25 is too much if you want to see many rows on screen without scrolling.

    Best regards,

    Sergey

  10. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    368 posts

    Posted 14 Sep Link to this post

    Hello Sergey,

    This does seem to be a bug on our side and I have thus logged a bug report in our feedback portal to which you can subscribe in order to get updated about any changes in its status. As a thank you for your help, I've awarded you with some Telerik points.

    What you can do for the time being is explicitly set the MinHeight property for the Style to 0​:

    <Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowCoreStyle}">
        <Setter Property="MinHeight" Value="0" />
    </Style>

    Then, in the ThemeManager class you will need to reapply the style as well:

    var gridViewRowStyle = new Style(typeof(GridViewRow)) { BasedOn = (Style)Application.Current.Resources["GridViewRowCoreStyle"] };
    var setter = new Setter(ContentControl.MinHeightProperty, 0.0);
    var setters = new SetterBaseCollection();
    gridViewRowStyle.Setters.Add(setter);
     
    Application.Current.Resources[typeof(GridViewRow)] = gridViewRowStyle;

    If you want to additionally limit the height for the editing elements, I'm you will need to modify the default styles for those controls as well. In the case of the Windows8Touch TextBox, this can be done like so:

    <Style BasedOn="{StaticResource TextBoxStyle}" TargetType="TextBox">
        <Setter Property="Padding" Value="0" />
    </Style>

    I hope you find all of this helpful. Do let me know if any other questions or concerns arise.

    Regards,
    Dilyan Traykov
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  11. Sergey
    Sergey avatar
    9 posts
    Member since:
    Sep 2016

    Posted 15 Sep Link to this post

    Hi, Thank you for help!
Back to Top
UI for WPF is Visual Studio 2017 Ready