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

custom layout and rowdetailstemplate

2 Answers 90 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jennifer
Top achievements
Rank 1
Jennifer asked on 04 Aug 2010, 04:32 AM

I was wondering if it was possible to use rowdetailstemplate with a custom layout in radgridview for silverlight. I had a project where the rowdetailstemplate worked fine without the custom template on the main grid. I have tried adding a radgridtogglebutton to the custom layout, as well as changing rowdetailsvisibility to Visible. I am using row details template because I make a separate call to a web service for each level of the hierarchy, and I am trying to do as much in possible in code to keep the silverlight control as general a possible.
The user control is below:.

 

 

 

 

 

<UserControl   x:Class="listo.SLGrid.GridControl"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"    
              xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"  
              xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"  
              xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"  
              xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"  
               
            xmlns:local="clr-namespace:listo.SLGrid"   
  
            Loaded="UserControl_Loaded" 
    <Canvas x:Name="LayoutRoot" Background="LightCoral" HorizontalAlignment="Stretch" >
        <StackPanel x:Name="gridStack" >
            <telerikGridView:RadGridView x:Name="crmDataGrid"   IsFilteringAllowed="False"   ShowInsertRow="True"
                    AddingNewDataItem="crmDataGrid_AddingNewDataItem"  BeginningEdit="crmDataGrid_BeginningEdit"
                                 RowEditEnded="crmDataGrid_RowEditEnded"
                             ScrollViewer.VerticalScrollBarVisibility="Auto" Grid.Row="1" Grid.Column="0"
                               RowDetailsVisibilityMode="Visible" 
                                     LoadingRowDetails="crmDataGrid_RowDetailsVisibilityChanged" ActionOnLostFocus="None" 
                                         >
            </telerikGridView:RadGridView>
  
        </StackPanel>
    </Canvas>
    <!--RowStyleSelector="{StaticResource styleSelector}"  RowDetailsVisibilityMode="Collapsed"-->
</UserControl>

The test template is simple, and works, except that my rowdetails are not accessible:

<Application.Resources>
    <ResourceDictionary
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"  >
        <ControlTemplate  x:Key="new_questionid" TargetType="telerikRow:GridViewRow"  >
            <Grid>
                <Grid.RowDefinitions >
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions >
                    <ColumnDefinition Width="20" />
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBox Grid.Column="1" Grid.Row="0" Text="Name"  />
                <telerikRow:GridViewToggleButton Name="RowDetailsToggle"  Grid.Column="0" Grid.Row="0" Grid.RowSpan="7" ></telerikRow:GridViewToggleButton>
            </Grid>
        </ControlTemplate>
        <Style x:Key="style_new_questionid" TargetType="telerikRow:GridViewRow">
            <Setter Property="Template" Value="{StaticResource new_questionid}" />
        </Style>
    </ResourceDictionary>
</Application.Resources>


I set rowdetails in code, the template is passed in parameters, but I could include in my resource dictionary if that would work better:

_crmGrid.RowDetailsTemplate = CreateRowDetailsTemplate(HttpUtility.UrlDecode(this.parameters[srpCrmSLGridParameters.rowDetailsTemplate]));

I was hoping that you could point me to an example where a custom layout was used along with row details. Ideally I would like to set both in code. Second choice would be to read them from a resource dictionary. Is this possible?

Thank you,

Jennifer

2 Answers, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 09 Aug 2010, 09:52 AM
Hello Jennifer,

It is possible to use both custom row and row details. In your custom row you will need to add a presenter for the details and the define the details template to show the data you wish. 

The default definition of the details presenter of the row is as follows:
<grid:DetailsPresenter x:Name="PART_DetailsPresenter" Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="1" Visibility="Collapsed" DetailsProvider="{TemplateBinding DetailsProvider}" telerik:StyleManager.Theme="{StaticResource Theme}" />

Keep us posted on your progress. 

Best wishes,
Kalin Milanov
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
Jennifer
Top achievements
Rank 1
answered on 12 Aug 2010, 12:34 AM
Thank you so much for your help, Kalin. I will give that a try.

Jennifer
Tags
GridView
Asked by
Jennifer
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Jennifer
Top achievements
Rank 1
Share this question
or