Error on mouse up after re-styling GridViewItemsControl

3 posts, 0 answers
  1. Will
    Will avatar
    27 posts
    Member since:
    Jun 2008

    Posted 19 Jun 2008 Link to this post

    Hi,

    After restyling the grid view items control to take out the group panel I get an error when clicking on cells:

      
    {System.ArgumentNullException: Value cannot be null
    Parameter name: reference 
       at System.Windows.Media.VisualTreeHelper.GetDescendantBounds(Visual reference) 
       at Telerik.Windows.Controls.UI.DragDropManager.IsMouseOverTarget(Visual target, GetPositionDelegate getPosition) 
       at Telerik.Windows.Controls.UI.GridViewItemsControl.OnPreviewMouseUp(MouseButtonEventArgs e) 
       at System.Windows.UIElement.OnPreviewMouseUpThunk(Object sender, MouseButtonEventArgs e) 
       at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) 
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) 
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) 
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) 
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) 
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) 
       at System.Windows.Input.InputManager.ProcessStagingArea() 
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) 
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) 


    My control template is as follows:

     <ControlTemplate x:Key="GridViewItemsControlTableTemplate" TargetType="{x:Type UI:GridViewItemsControl}"
        <Grid Background="{TemplateBinding Background}"
            <Grid.Resources> 
                    <UI:DoubleToGridLengthConverter x:Key="DoubleToGridLengthConverter" /> 
            </Grid.Resources> 
                <Grid.RowDefinitions> 
                    <RowDefinition Height="Auto" /> 
                    <RowDefinition /> 
                    <RowDefinition x:Name="ScrollBarRow" MinHeight="10"  
                                   Height="{Binding Source={StaticResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}},  
                        Converter={StaticResource DoubleToGridLengthConverter}}"/> 
                </Grid.RowDefinitions> 
                <Grid.ColumnDefinitions> 
                    <ColumnDefinition /> 
                    <ColumnDefinition x:Name="ScrollBarColumn" MinWidth="10" Width="{Binding Source={StaticResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}, Converter={StaticResource DoubleToGridLengthConverter}}"/> 
                </Grid.ColumnDefinitions> 
                             
                <UI:GridViewBackground x:Name="PART_GridViewBackground" Margin="10,0,0,0" Grid.Row="0"  
                                       Grid.ColumnSpan="1" Grid.RowSpan="2"  
                                       HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsHitTestVisible="False"/> 
     
                <StackPanel Grid.Row="0"
                    <Border Margin="0,0,0,0" BorderThickness="0" ClipToBounds="True" 
                            Background="{StaticResource {x:Static Resources:FunctionalBrushes.EntityTabBackgroundBrushKey}}"
                        <UI:GridViewHeaderRow Name="PART_HeaderRow" VerticalAlignment="Top"/> 
                    </Border> 
                    <UI:GridViewNewRow Name="PART_AddNewRow" Margin="10,0,0,0"  
                                       VerticalAlignment="Bottom" HorizontalAlignment="Stretch"  
                                       Visibility="Collapsed" /> 
                </StackPanel> 
     
                <ScrollViewer Name="PART_ItemsScrollViewer" Focusable="False" VerticalScrollBarVisibility="Auto"  
                              HorizontalScrollBarVisibility="Auto"  
                              CanContentScroll="True" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2"
                    <ItemsPresenter Margin="10, 0, 0, 0"/> 
                </ScrollViewer> 
            </Grid> 
            <ControlTemplate.Triggers>           
                <Trigger Property="ComputedVerticalScrollBarVisibility" SourceName="PART_ItemsScrollViewer" Value="Collapsed"
                    <Setter Property="Width" TargetName="ScrollBarColumn" Value="10" /> 
                </Trigger> 
                <Trigger Property="ComputedHorizontalScrollBarVisibility" SourceName="PART_ItemsScrollViewer" Value="Collapsed"
                    <Setter Property="Height" TargetName="ScrollBarRow" Value="10" /> 
                </Trigger> 
            </ControlTemplate.Triggers> 
        </ControlTemplate> 

    Have I done something wrong or is this a bug?

    Kind regards,

    Will Holley

  2. Hristo Deshev
    Admin
    Hristo Deshev avatar
    559 posts

    Posted 20 Jun 2008 Link to this post

    Hi Will,

    I managed to reproduce the error. It is caused by a bug in the control -- the code "assumes" the group panel is always present. We have reworked the drag/drop grouping code and the bug does not appear in our latest dev builds.

    We are working on publishing a second beta build release at the end of next week that will have that and the rest of the issues you reported fixed. In addition we will have a public property that will allow you to hide the group panel, so that you won't have to define the control template yourself.

    Greetings,
    Hristo Deshev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Will
    Will avatar
    27 posts
    Member since:
    Jun 2008

    Posted 20 Jun 2008 Link to this post

    Thanks Hristo - looking forward to the next beta!
Back to Top