RowDetailsTemplate horizontal stretch

5 posts, 0 answers
  1. Jorn
    Jorn avatar
    222 posts
    Member since:
    Jun 2009

    Posted 12 Mar 2010 Link to this post

    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.
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 15 Mar 2010 Link to this post

    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.
  3. DevCraft banner
  4. George Felipe
    George Felipe avatar
    11 posts
    Member since:
    Nov 2009

    Posted 07 Apr 2010 Link to this post

    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> 




  5. George Felipe
    George Felipe avatar
    11 posts
    Member since:
    Nov 2009

    Posted 07 Apr 2010 Link to this post

    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
  6. Sven J
    Sven J avatar
    26 posts
    Member since:
    Nov 2009

    Posted 06 Jul 2011 Link to this post

    Hi,

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

    Greetings,
    Sven
Back to Top
DevCraft banner