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

RowStyle cause blank rows

2 Answers 163 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Laurent
Top achievements
Rank 1
Laurent asked on 19 Sep 2013, 09:43 PM
Hello,

I'm trying to implement drag&drop in a radgridview.

I'm using this how to :
http://www.telerik.com/help/wpf/dragdropmanager-howto-draganddrop-within-radgridview.html

Everything is ok, but as soon as I add rowstyle code block, my rows are displayed blank (scrollbar remains visible).

This code is ok :

<telerik:RadGridView ItemsSource="{Binding Object.Details.Attributes}"
                        AutoGenerateColumns="True"
                        ScrollViewer.CanContentScroll="True"
                        ScrollViewer.HorizontalScrollBarVisibility="Visible"
                        ScrollViewer.VerticalScrollBarVisibility="Visible"
                        CanUserDeleteRows="False"
                        CanUserInsertRows="False"
                        CanUserReorderColumns="False"
                        CanUserResizeRows="False"
                        CanUserFreezeColumns="False"
                        CanUserSortColumns="False"
                        IsFilteringAllowed="False"
                        RowIndicatorVisibility="Collapsed"
                        ShowGroupPanel="False"
                        DataLoadMode="Asynchronous"
                        IsReadOnly="{Binding IsEditing, Converter={StaticResource InvertBoolConverter}}"
                        EnableRowVirtualization="True"
                        FrozenColumnCount="1"
                        AllowDrop="True"
                        behaviors:RowReorderBehavior.IsEnabled="True"
                        BeginningEdit="Attributes_RadGridView_BeginningEdit"
                     >
 
    <telerik:RadGridView.Resources>
        <DataTemplate x:Key="DraggedItemTemplate">
            <StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Dragging:" />
                    <TextBlock Text="{Binding CurrentDraggedItem}"
                  FontWeight="Bold" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding CurrentDropPosition}" FontWeight="Bold" MinWidth="45" />
                    <TextBlock Text=", (" Foreground="Gray" />
                    <TextBlock Text="{Binding CurrentDraggedOverItem}" />
                    <TextBlock Text=")"
                  Foreground="Gray" />
                </StackPanel>
            </StackPanel>
        </DataTemplate>
    </telerik:RadGridView.Resources>
     
 
 
 
    <telerik:RadGridView.Columns>
 
        <telerik:GridViewDataColumn Header="Attribute" DataMemberBinding="{Binding Attribute.TechName}" IsReadOnly="True"/>
        .......
        <telerik:GridViewDataColumn Header="Length" DataMemberBinding="{Binding Attribute.Details.LengthInternal}" IsReadOnly="True"/>
    </telerik:RadGridView.Columns>
     
</telerik:RadGridView>

But with this code, rows are displayed blank (only headers and scrollbars are visibles) :

<telerik:RadGridView ItemsSource="{Binding Object.Details.Attributes}"
                        AutoGenerateColumns="True"
                        ScrollViewer.CanContentScroll="True"
                        ScrollViewer.HorizontalScrollBarVisibility="Visible"
                        ScrollViewer.VerticalScrollBarVisibility="Visible"
                        CanUserDeleteRows="False"
                        CanUserInsertRows="False"
                        CanUserReorderColumns="False"
                        CanUserResizeRows="False"
                        CanUserFreezeColumns="False"
                        CanUserSortColumns="False"
                        IsFilteringAllowed="False"
                        RowIndicatorVisibility="Collapsed"
                      
                        ShowGroupPanel="False"
                        DataLoadMode="Asynchronous"
                        IsReadOnly="{Binding IsEditing, Converter={StaticResource InvertBoolConverter}}"
                        EnableRowVirtualization="True"
                        FrozenColumnCount="1"
                        AllowDrop="True"
                        behaviors:RowReorderBehavior.IsEnabled="True"
                        BeginningEdit="Attributes_RadGridView_BeginningEdit"
                     >
 
    <telerik:RadGridView.Resources>
        <DataTemplate x:Key="DraggedItemTemplate">
            <StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Dragging:" />
                    <TextBlock Text="{Binding CurrentDraggedItem}"
                  FontWeight="Bold" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding CurrentDropPosition}" FontWeight="Bold" MinWidth="45" />
                    <TextBlock Text=", (" Foreground="Gray" />
                    <TextBlock Text="{Binding CurrentDraggedOverItem}" />
                    <TextBlock Text=")"
                  Foreground="Gray" />
                </StackPanel>
            </StackPanel>
        </DataTemplate>
    </telerik:RadGridView.Resources>
     
 
 
 
    <telerik:RadGridView.Columns>
 
        <telerik:GridViewDataColumn Header="Attribute" DataMemberBinding="{Binding Attribute.TechName}" IsReadOnly="True"/>
           .....
        <telerik:GridViewDataColumn Header="Length" DataMemberBinding="{Binding Attribute.Details.LengthInternal}" IsReadOnly="True"/>
    </telerik:RadGridView.Columns>
 
    <telerik:RadGridView.RowStyle>
        <Style TargetType="telerik:GridViewRow">
            <Setter Property="Background" Value="Red"/>
            <Setter Property="telerik:DragDropManager.AllowDrag" Value="True" />
        </Style>
    </telerik:RadGridView.RowStyle>
 
</telerik:RadGridView>



Do you know what is the root cause ?

Thanks in advance,

Laurent

2 Answers, 1 is accepted

Sort by
0
Laurent
Top achievements
Rank 1
answered on 21 Sep 2013, 10:23 PM
Hi all,

It took me a long (very very long) time, but I finally found the solution.

When you use implicit styles, you need to add following statement in style block declaration :

BasedOn="{StaticResource GridViewRowStyle}"

It can be a good thing to add this in official documentation.

Regards,

Laurent
0
Dimitrina
Telerik team
answered on 23 Sep 2013, 06:15 AM
Hi Laurent,

You can check our documentation on Implicit Styles where this is explained.
Thank you for your feedback. I will update the article about DragDropManager, you referred to.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Laurent
Top achievements
Rank 1
Answers by
Laurent
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or