RadGridView Column Auto Sizing

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    1 posts
    Member since:
    Apr 2008

    Posted 04 Jun 2013 Link to this post

    Hi,

    I am trying to do a gridview that has only one column that should size to the remaining area of the container it sits in. I set it to '*' but it will not take up the remaining size of the containing grid. The column that needs to size to the rest of the grid is the 'Patient' column. All others colums are required to be a fixed size.

    The xaml is as follows:
    <UserControl x:Class="HCF.Enterprise.Module1.Views.ServiceDetail"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 mc:Ignorable="d"
                 d:DesignWidth="1000" >
        <Grid x:Name="LayoutServiceDetails" Width="Auto" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition x:Name="grdServiceDetailsHeader" Height="15"/>
                <RowDefinition x:Name="grdServiceDetailsLines" Height="*"/>
            </Grid.RowDefinitions>
            <Rectangle Margin="0,0,0,0" Grid.RowSpan="2" Fill="#FFFFFFFF" Stroke="#FFEDF7FA" x:Name="mainBackgroundServiceDetails"/>
            <Rectangle Margin="0,0,0,0" Fill="#FFEDF7FA" Stroke="#FFEDF7FA" x:Name="backgroundServiceDetailsHdr"/>
            <TextBlock Height="Auto" VerticalAlignment="Stretch" Text="Service Details" Margin="5,0,0,1" Foreground="#FFA70639" x:Name="lblServiceDetailsHdr" />
            
            <telerik:RadGridView x:Name="serviceItemGridView" Grid.Row="1" Margin="5,0,5,5"
                                 IsFilteringAllowed="False" BorderThickness="0"
                                 ShowGroupPanel="False"
                                 RowIndicatorVisibility="Collapsed"
                                 CanUserResizeColumns="False"
                                 CanUserReorderColumns="False"
                                 CanUserFreezeColumns="False"
                                 FontSize="11" FontFamily="Segoe UI" ColumnWidth="*"
                                 VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                                 AutoGenerateColumns="False" >
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn x:Name="LineNo" Width="26" MaxWidth="26" >
                        <telerik:GridViewDataColumn.AggregateFunctions>
                            <telerik:CountFunction Caption="Count: " />
                        </telerik:GridViewDataColumn.AggregateFunctions>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewSelectColumn x:Name="BulkCheck" HeaderTextAlignment="Center" Header="Bulk" Width="28" MaxWidth="28"/>
                    <telerik:GridViewSelectColumn x:Name="RecordOnlyCheck" Width="32" MaxWidth="32" >
                        <telerik:GridViewSelectColumn.Header>
                            <TextBlock Text="Rec Only" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewSelectColumn.Header>
                    </telerik:GridViewSelectColumn>
                    <telerik:GridViewComboBoxColumn x:Name="Patient" HeaderTextAlignment="Center" Header="Patient" Width="*" MinWidth="266" >
     
                    </telerik:GridViewComboBoxColumn>
                    <telerik:GridViewDataColumn x:Name="DateOfService" DataFormatString="{}{0:yyyy}" Width="101" MaxWidth="101">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Date of Service" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewComboBoxColumn x:Name="ServiceType" Width="50" MaxWidth="50" >
                        <telerik:GridViewComboBoxColumn.Header>
                            <TextBlock Text="Service Type" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewComboBoxColumn.Header>
                    </telerik:GridViewComboBoxColumn>
                    <telerik:GridViewDataColumn x:Name="ProviderNo" Width="75" MaxWidth="75">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Provider No." TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="FindProvider" Width="22" MaxWidth="22" >
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="ItemNo" Width="55">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Item No." TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="FindItem" Width="22" MaxWidth="22" >
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="Quantity" Width="38" MaxWidth="38">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Qty" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="Charge" Width="60" MaxWidth="60">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Charge" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewDataColumn.AggregateFunctions>
                            <telerik:SumFunction Caption="Total Charge: " />
                        </telerik:GridViewDataColumn.AggregateFunctions>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewComboBoxColumn x:Name="Paid" Width="45" MaxWidth="45" >
                        <telerik:GridViewComboBoxColumn.Header>
                            <TextBlock Text="Paid" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewComboBoxColumn.Header>
                    </telerik:GridViewComboBoxColumn>
                    <telerik:GridViewComboBoxColumn x:Name="AdjustmentCode" Width="45" MaxWidth="45" >
                        <telerik:GridViewComboBoxColumn.Header>
                            <TextBlock Text="Adjust Code" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewComboBoxColumn.Header>
                    </telerik:GridViewComboBoxColumn>
                    <telerik:GridViewDataColumn x:Name="ScheduleFee" Width="60" MaxWidth="60">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Schedule Fee" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="TotalBenefit" Width="60" MaxWidth="60">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Total Benefit" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                        <telerik:GridViewDataColumn.AggregateFunctions>
                            <telerik:SumFunction Caption="Total Benefit: " />
                        </telerik:GridViewDataColumn.AggregateFunctions>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="ExplanationCode" Width="45" MaxWidth="45">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Explain Code" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="OriginalItem" Width="55" MaxWidth="55">
                        <telerik:GridViewDataColumn.Header>
                            <TextBlock Text="Orig Item" TextAlignment="Center" TextWrapping="Wrap" />
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn x:Name="RemoveRow" Width="50" >
                        <telerik:GridViewDataColumn.Header>
                            <StackPanel Orientation="Horizontal">
                                <telerik:RadButton HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="3,3,3,3" Cursor="Hand" x:Name="AddItemService" CornerRadius="10" Height="17" Width="17" FontFamily="Verdana" FontSize="10" FontWeight="Normal" Content="+" IsTabStop="False" BorderBrush="#FF003366" Foreground="White" >
                                    <telerik:RadButton.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFBEDEFD" Offset="0"/>
                                            <GradientStop Color="#FF00478B" Offset="0.5"/>
                                            <GradientStop Color="#FF003366" Offset="0.5"/>
                                            <GradientStop Color="#FF2C97FF" Offset="1"/>
                                        </LinearGradientBrush>
                                    </telerik:RadButton.Background>
                                </telerik:RadButton>
                                <TextBox Text="4" VerticalAlignment="Center" MaxLength="2" Width="25" />
                            </StackPanel>
                        </telerik:GridViewDataColumn.Header>
                    </telerik:GridViewDataColumn>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </Grid>
    </UserControl>

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1216 posts

    Posted 06 Jun 2013 Link to this post

    Hi,

    This is rather strange. I have tested a similar scenario on my side and it seems to be working as expected. May I ask you to send us a runnable project that illustrates the issue, so that we could debug it on our side?

    Regards,
    Ivan Ivanov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top