column widths initially not set correct

4 posts, 0 answers
  1. Michael
    Michael avatar
    4 posts
    Member since:
    Dec 2011

    Posted 05 Jan 2015 Link to this post

    hi,
    following setup: a radpane with a user control with a grid that has two rows (row 1 is height auto, row 2 is height *), the second row contains a radgridview. the gridview holds four columns gridviewdatacolumn, nothing fancy. i'm assigning an observablecollection to the itemssource in the usercontrol.loaded event handler.

    for some reason the column widths are not set when starting the software. instead they are as it looks like set to the minimum width. it worked before and i can't remember doing anything to this part of the application.

    i have to resize the pane or a column a bit or re-assign the observablecollection to the itemssource and then the correct widths are applied. tried with ColumnWidth="*" and with Width="*" on the GridViewDataColumn entries. also setting AutoGenerateColumns to true shows the same result. setting ColumnWidth="Auto" at least shows the full content for each row but looks ugly because it leaves too much whitespace.

    i also replaced the whole usercontrol with a backup i made yesterday but same result. works in the backup, not in the current version. replaced also the other controls with old code and it's still not working. 

    any clue what could cause this behaviour or at least how i can force the gridview to recalculate the column sizes once the control is displayed?

            
    <telerik:RadGridView Grid.Row="1" ColumnWidth="*" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ShowGroupPanel="False" AutoGenerateColumns="False" CanUserInsertRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" ShowColumnHeaders="True" CanUserSortColumns="False" RowIndicatorVisibility="Collapsed">
     
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Title, Mode=OneWay}"   IsReadOnly="True" Header="Chord" />
            <telerik:GridViewDataColumn DataMemberBinding="{Binding DisplayNotes, Mode=OneWay}"  IsReadOnly="True" Header="Notes" />
            <telerik:GridViewDataColumn DataMemberBinding="{Binding NumNotes, Mode=OneWay}"   IsReadOnly="True" Header="Notes"/>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding PlayKey, Mode=OneWay}"   IsReadOnly="True" Header="Play"/>
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1218 posts

    Posted 06 Jan 2015 Link to this post

    Hello,

    Can you please confirm whether you had updated Telerik UI for WPF with a newer version before you experienced this behavior? If so, could you share which is the new version, so that we can investigate any relevant changes on our side? 
    As for the problem itself, is it reproducible without using RadPange? May I ask you to try isolating the issue in a demo project illustrating your exact setup? You can also take a look at this blog post for a reference on how to isolate an issue.  

    Regards,
    Ivan Ivanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Michael
    Michael avatar
    4 posts
    Member since:
    Dec 2011

    Posted 06 Jan 2015 in reply to Ivan Ivanov Link to this post

    hi,
    i didn't update recently. but just to be sure, i reinstalled everything. version is now 2014.3.1202.0

    the column widths are set correctly when moving the radgridview outside of the whole docking layout into a simple grid column.

    however, i solved the issue. in another pane left of the radgridview i have some control which contains an itemcontrol with a stackpanel and the items displayed use a usercontrol which has sizechanged handler. in this function the height of some elements in this item usercontrol is set to a value proportional to the actualheight of their parent. for one specific element the height was set to equal actualheight of its parent, however the available space is actualheight-1. so by setting the height of the child control 1px too high, it forced the parent to resize, which again triggered another sizechanged event, around 700 times until the control is fully loaded and magically displayed with the right height.

    i have no idea, how this is connected to the incorrect size of columns in a radgridview in the pane next to it, esp. since there are two other panes with radgridviews in the same interface which weren't affected.

    best regards
    michael
  4. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1218 posts

    Posted 09 Jan 2015 Link to this post

    Hi,

    I am glad to hear that you have found solution to this problem. It looks like a complex and very scenario-specific issue. We will be glad to provide further assistance if it is needed.

    Regards,
    Ivan Ivanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top