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

How to determine the actual width of the gridview?

1 Answer 181 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ludwig
Top achievements
Rank 1
Ludwig asked on 04 May 2011, 07:11 PM
Hi,

I have a grid like:

<telerik:RadGridView Name="patientsGridView" SelectionMode="Extended" ItemsSource="{Binding Patients}" SelectedItem="{Binding SelectedPatient}" AutoGenerateColumns="False" IsReadOnly="True" MouseDoubleClick="patientsGridView_MouseDoubleClick" RowIndicatorVisibility="Collapsed" SelectionChanged="patientsGridView_SelectionChanged" GroupPanelStyle="{DynamicResource GridViewGroupPanelStyle1}" >                      
    <telerik:RadGridView.Columns>

<!-- IsActiveGroup -->
<telerik:GridViewDataColumn DataMemberBinding="{Binding IsActiveGroup}" >
<telerik:GridViewDataColumn.FilteringControl>
<GridView:FilteringControl Style="{DynamicResource FilteringControlStyle}"/>
</telerik:GridViewDataColumn.FilteringControl>
<telerik:GridViewDataColumn.Header>
<TextBlock Text=" " ToolTip="{lex:LocText S3.ParametersUE.PatientManagement:UIStrings:PatientListView_PatientGridColumnIsActiveToolTip}"/>
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=IsActiveImageSource, Converter={StaticResource imgConverter}}" Stretch="UniformToFill" RenderOptions.BitmapScalingMode="HighQuality" Width="20" Height="20" ToolTip="{Binding IsActiveGroup}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
 <!-- HasWarningGroup -->
<telerik:GridViewDataColumn DataMemberBinding="{Binding HasWarningGroup}" >
<telerik:GridViewDataColumn.FilteringControl>
<GridView:FilteringControl Style="{DynamicResource FilteringControlStyle}"/>
</telerik:GridViewDataColumn.FilteringControl>
<telerik:GridViewDataColumn.Header>
<TextBlock Text=" " ToolTip="{lex:LocText S3.ParametersUE.PatientManagement:UIStrings:PatientListView_PatientGridColumnHasWarningToolTip}"/>
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Path=HasWarningImageSource, Converter={StaticResource imgConverter}}" Stretch="UniformToFill" RenderOptions.BitmapScalingMode="HighQuality" Width="20" Height="20" ToolTip="{Binding HasWarningGroup}" />
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>

etc...

I need the width of the grid - but ActualWidth is always 0. How can I get the width of the grid?





1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 05 May 2011, 11:30 AM
Hi Ludwig,

This sounds quite strange. Are you sure that the RadGridView is attached to the visual tree at the moment you are checking its width? If you want to determine its width as soon as possible you may try doing it on its Loaded event. You might want to see the attached project for more extensive information.

Kind regards,
Ivan Ivanov
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
Tags
GridView
Asked by
Ludwig
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or