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

RowDetailsTemplate horizontal stretch

4 Answers 193 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Trude
Top achievements
Rank 2
Trude asked on 12 Mar 2010, 05:23 PM
I've been experimenting with the RowDetailsTemplate, but I can't figure out how to stretch it's contents horizontally. More specifically I have a couple of textboxes that I want to stretch to the full width (minus som margins) of the rowdetails. I hope there is a solution that doesn't involve the sizechanged event to expand the textboxes.

4 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 15 Mar 2010, 07:50 AM
Hello Jorn,

You can stretch the content with a simple style:

<telerik:RadGridView.RowDetailsStyle>
    <Style TargetType="grid:DetailsPresenter">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>
</telerik:RadGridView.RowDetailsStyle>

Hope this helps.


Greetings,
Milan
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.
0
George Felipe
Top achievements
Rank 1
answered on 07 Apr 2010, 10:17 PM
Hi,

I have attempted to add this style to my RadGridView and I get the following exception:
"Invalid attribute value grid:DetailsPresenter for property TargetType. [Line: 93 Position: 51]"

Am I doing something wrong? Where is the style suppose to go? And why isn't horizontal stretch the default behavior?


Here is my grid just incase.

<telerikGrid:RadGridView x:Name="grdCustList" Grid.Column="1" AutoGenerateColumns="False"  
                                                 IsReadOnly="True" IsFilteringAllowed="False" ShowGroupPanel="False" 
                                                 SelectionChanged="grdCustList_SelectionChanged" RowDetailsVisibilityMode="VisibleWhenSelected" > 
                            <telerikGrid:RadGridView.Columns> 
                                <telerikGrid:GridViewDataColumn Header="ID"  DataMemberBinding="{Binding CustID}"/> 
                                <telerikGrid:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}"/> 
                                <telerikGrid:GridViewDataColumn Header="City" DataMemberBinding="{Binding City}"/> 
                                <telerikGrid:GridViewDataColumn Header="State" DataMemberBinding="{Binding State}"/> 
                                <telerikGrid:GridViewDataColumn Header="Country" DataMemberBinding="{Binding Country}"/> 
                            </telerikGrid:RadGridView.Columns> 
                            <telerikGrid:RadGridView.RowDetailsStyle> 
                                <Style TargetType="grid:DetailsPresenter"
                                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/> 
                                </Style> 
                            </telerikGrid:RadGridView.RowDetailsStyle> 
                            <telerikGrid:RadGridView.RowDetailsTemplate>                                     
                                <DataTemplate >    
                                        <telerikNav:RadTabControl Width="Auto"
                                            <telerikNav:RadTabItem Header="Customer Info"
                                                <Grid Margin="10"
                                                    <Grid.ColumnDefinitions> 
                                                        <ColumnDefinition/> 
                                                        <ColumnDefinition/> 
                                                        <ColumnDefinition/> 
                                                    </Grid.ColumnDefinitions> 
                                                    <StackPanel> 
                                                        <TextBlock Text="General Info" FontWeight="Bold" HorizontalAlignment="Center"/> 
                                                        <StackPanel  Orientation="Horizontal" > 
                                                            <StackPanel> 
                                                                <TextBlock Text="Type:"/> 
                                                                <TextBlock Text="Cust Group:"/> 
                                                                <TextBlock Text="Market Seg:"/> 
                                                                <TextBlock Text="Sub Cust ID:"/> 
                                                                <TextBlock Text="Report Group:"/> 
                                                                <CheckBox Content="Inactive" IsChecked="{Binding Inactive}" IsEnabled="False"/> 
                                                                <CheckBox Content="Nat Acct" IsChecked="{Binding NationalAcct}" IsEnabled="False"/> 
                                                            </StackPanel> 
                                                            <StackPanel Margin="5,0,0,0"
                                                                <TextBlock Text="{Binding CustomerType}"/> 
                                                                <TextBlock Text="{Binding GroupDescription}" /> 
                                                                <TextBlock Text="{Binding MarketSegment}" /> 
                                                                <TextBlock Text="{Binding SubCustID}" /> 
                                                                <TextBlock Text="{Binding ReportGroup}" /> 
                                                            </StackPanel> 
                                                        </StackPanel> 
                                                    </StackPanel> 
                                                    <StackPanel Grid.Column="1"
                                                        <TextBlock Text="Location Info" FontWeight="Bold" HorizontalAlignment="Center"/> 
                                                        <StackPanel Orientation="Horizontal"
                                                            <StackPanel> 
                                                                <TextBlock Text="Address:"/> 
                                                                <TextBlock Text=" "/> 
                                                                <TextBlock Text=" "/> 
                                                                <TextBlock Text="City:"/> 
                                                                <TextBlock Text="State:"/> 
                                                                <TextBlock Text="Zip:"/> 
                                                                <TextBlock Text="Country:"/> 
                                                            </StackPanel> 
                                                            <StackPanel Margin="5,0,0,0"
                                                                <TextBlock Text="{Binding Address1}"/> 
                                                                <TextBlock Text="{Binding Address2}" /> 
                                                                <TextBlock Text="{Binding Address3}" /> 
                                                                <TextBlock Text="{Binding City}" /> 
                                                                <TextBlock Text="{Binding State}" /> 
                                                                <TextBlock Text="{Binding Zip}" /> 
                                                                <TextBlock Text="{Binding Country}" /> 
                                                            </StackPanel> 
                                                        </StackPanel> 
                                                    </StackPanel> 
                                                    <StackPanel Grid.Column="2"
                                                        <TextBlock Text="Main Contact Info" FontWeight="Bold" HorizontalAlignment="Center"/> 
                                                        <StackPanel Orientation="Horizontal"
                                                            <StackPanel> 
                                                                <TextBlock Text="Phone Num:"/> 
                                                                <TextBlock Text="Fax Num:"/> 
                                                                <TextBlock Text="E-Mail:"/> 
                                                                <TextBlock Text="Sales Rep:"/> 
                                                            </StackPanel> 
                                                            <StackPanel Margin="5,0,0,0"
                                                                <TextBlock Text="{Binding PhoneNum}"/> 
                                                                <TextBlock Text="{Binding FaxNum}" /> 
                                                                <TextBlock Text="{Binding EmailAddress}" /> 
                                                                <TextBlock Text="{Binding SalesRepCode}" /> 
                                                            </StackPanel> 
                                                        </StackPanel> 
                                                    </StackPanel> 
 
                                                </Grid> 
 
                                            </telerikNav:RadTabItem> 
                                        </telerikNav:RadTabControl>                                             
                                </DataTemplate> 
                            </telerikGrid:RadGridView.RowDetailsTemplate> 
                        </telerikGrid:RadGridView> 




0
George Felipe
Top achievements
Rank 1
answered on 07 Apr 2010, 10:56 PM
Cancel that. I found how to do it via Expression Blend and this link:
http://www.telerik.com/help/silverlight/gridview-styling-row-details.html
0
Sven J
Top achievements
Rank 2
answered on 06 Jul 2011, 08:47 AM
Hi,

just to complete this thread: Use the correct namespace in the styles' TargetType than stretching content just works fine.

Greetings,
Sven
Tags
GridView
Asked by
Trude
Top achievements
Rank 2
Answers by
Milan
Telerik team
George Felipe
Top achievements
Rank 1
Sven J
Top achievements
Rank 2
Share this question
or