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

column widths initially not set correct

3 Answers 197 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 06 Jan 2015, 01:24 AM
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>

3 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 06 Jan 2015, 09:49 AM
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.

 
0
Michael
Top achievements
Rank 1
answered on 06 Jan 2015, 07:37 PM
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
0
Ivan Ivanov
Telerik team
answered on 09 Jan 2015, 04:57 PM
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.

 
Tags
GridView
Asked by
Michael
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Michael
Top achievements
Rank 1
Share this question
or