Hi
We are using telerik grid view and facing scroll bar and column size issues if we define column size as "*" in any column.
Could you please see below scenarios and help us in fixing these issues:
Case 1: Use of telerik control scroll bar:
Requirement : In our telerik grid view we want to set some column with fixed width and some variable width("*").
Issue: Horizontal scroll bar doesn't spread acording to the column width,its width is always fixed due to this column with width "*" doesn't spread at all.Please find an attached snapshot of the screen (Case1.png)
See elow eg . in which column name company is set as variable width:-
Case 1 : Code Snippet :
<Grid x:Name="radGridView" Grid.Row="1" Margin="0,30">
<!--Change Detail section-->
<telerik:RadGridView ColumnWidth="150" IsTabStop="False" x:Name="radGridView1" CanUserResizeColumns="False" IsReadOnly="True" CanUserFreezeColumns="False" RowStyle="{StaticResource rowStyle}" ItemsSource="{Binding DemoClasses}" ShowColumnFooters="False" GridLinesVisibility="None" RowIndicatorVisibility="Collapsed" telerikGridViewHeaderMenu:GridViewHeaderMenu.IsEnabled="True" ActionOnLostFocus="None" ShowGroupPanel="False" AutoGenerateColumns="False" Margin="0,-9,-1,0">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn IsSortable="False" >
<telerik:GridViewDataColumn.Header>
<TextBlock Text="Id" TextWrapping="Wrap" TextAlignment="Center"/>
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ID}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="ClassName" DataMemberBinding="{Binding Name}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Company" DataMemberBinding="{Binding Company}" Width="*">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Company}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="Completed?" DataMemberBinding="{Binding IsComplete}" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding IsComplete}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="DueDate" DataMemberBinding="{Binding DueDate}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock TextAlignment="Center" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center">
<Run Text="{Binding DueDate, StringFormat={}{0:MM/dd/yyyy}}"/>
<LineBreak/>
<Run Text="{Binding DueDate, StringFormat={}{0: hh:mm tt}}"/>
</TextBlock>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" HeaderCellStyle="{DynamicResource columnSelectorHeaderCellStyle}" >
<telerik:GridViewDataColumn.Header>
<StackPanel Orientation="Horizontal">
<Image x:Name="image1" Source="Images/images.jpg" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20,5,5,5" MouseLeftButtonDown="Image_MouseDown"/>
</StackPanel>
</telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
Case 2: Use of scroll viewer:
Requirement : same as case 1.
Issue: horizontal scroll bar works perfectly but column with "*" width takes the width almost equals to the screen width. we have set the width as "*" only so from where it is taking this much of width.please find an attached snapshot of the screen(Case2.png)
See elow eg . in which column name company is set as variable width and scroll viewer is being used:-
Case 2 : Code Snippet :
<Grid x:Name="radGridView" Grid.Row="1" Margin="0,30">
<!--Change Detail section-->
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<telerik:RadGridView ColumnWidth="150" IsTabStop="False" x:Name="radGridView1" CanUserResizeColumns="False" IsReadOnly="True" CanUserFreezeColumns="False" RowStyle="{StaticResource rowStyle}" ItemsSource="{Binding DemoClasses}" ShowColumnFooters="False" GridLinesVisibility="None" RowIndicatorVisibility="Collapsed" telerikGridViewHeaderMenu:GridViewHeaderMenu.IsEnabled="True" ActionOnLostFocus="None" ShowGroupPanel="False" AutoGenerateColumns="False" Margin="0,-9,-1,0">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn IsSortable="False" >
<telerik:GridViewDataColumn.Header>
<TextBlock Text="Id" TextWrapping="Wrap" TextAlignment="Center"/>
</telerik:GridViewDataColumn.Header>
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ID}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="ClassName" DataMemberBinding="{Binding Name}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Company" DataMemberBinding="{Binding Company}" Width="*">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Company}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="Completed?" DataMemberBinding="{Binding IsComplete}" >
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding IsComplete}" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" Header="DueDate" DataMemberBinding="{Binding DueDate}">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock TextAlignment="Center" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" HorizontalAlignment="Center" VerticalAlignment="Center">
<Run Text="{Binding DueDate, StringFormat={}{0:MM/dd/yyyy}}"/>
<LineBreak/>
<Run Text="{Binding DueDate, StringFormat={}{0: hh:mm tt}}"/>
</TextBlock>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn IsSortable="False" HeaderCellStyle="{DynamicResource columnSelectorHeaderCellStyle}" >
<telerik:GridViewDataColumn.Header>
<StackPanel Orientation="Horizontal">
<Image x:Name="image1" Source="Images/images.jpg" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20,5,5,5" MouseLeftButtonDown="Image_MouseDown"/>
</StackPanel>
</telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</ScrollViewer>
</Grid>
Note : WHen all column's width is fixed then grid view behaviour is quite good but this doesn't suit our requirement.Attached is the snapshot of the grid when column width is fixed(radgridview.jpg).
We want our grid to autosize to fill the view acordingly.
Looking forward for the reply.