Home Forums WPF controls Xceed DataGrid for WPF Error when dragging column over header with an underscore

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #27191 |

    I’m getting the following exception when dragging a column over another column that has an underscore in the column header name.  The error occurs when the mousing over the actual column header text, but not the empty space within the column header.  However, I found that the error does not occur if I remove the underscore from the header name.

    System.InvalidOperationException

    ‘System.Windows.Documents.Run’ is not a Visual or Visual3D.

       at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
       at System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
       at Xceed.Utils.Wpf.DragDrop.DragSourceManager.GetDropTargetAtPoint(MouseEventArgs e)
       at Xceed.Utils.Wpf.DragDrop.DragSourceManager.Drag(MouseEventArgs e)
       at Xceed.Utils.Wpf.DragDrop.DragSourceManager.ProcessMouseMove(MouseEventArgs e)
       at Xceed.Wpf.DataGrid.ColumnManagerCell.OnMouseMove(MouseEventArgs e)
       at System.Windows.UIElement.OnMouseMoveThunk(Object sender, MouseEventArgs e)
       at System.Windows.Input.MouseEventArgs.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(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)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

    Are there any other workarounds besides removing the underscore?

    Imported from legacy forums. Posted by PP (had 3289 views)

    Xceed Support
    Member
    Post count: 5658

    I was not able to reproduce the error you are reporting. Would it be possible for you to provide more information, such as column settings, or send a repro application to support@xceedsoft.com?

    Imported from legacy forums. Posted by Jenny [Xceed] (had 816 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Jenny,

    You can reproduce the error by setting a column header with underscores, like “Text_001”. When you drag this header, you should see the exception.

    I fixed a samilar error in our application before. The reason is when trying to get the e.OriginalSource from the MouseButtonEventArgs to get the drag UIElement, if there are undersocres in the text, WPF will return System.Windows.Documents.Run instead of UIElement.

    Hope you can get some ideas from my message and fix the error.

     

     

    Imported from legacy forums. Posted by oldtree (had 899 views)

    Xceed Support
    Member
    Post count: 5658

    I set the Title property to a string with an underscore in it and was not able to reproduce the error. How are you setting the title?

    Imported from legacy forums. Posted by Jenny [Xceed] (had 830 views)

    User (Old forums)
    Member
    Post count: 23064

    As of Today using 2009-04-01’s version, I am having exactly the same problem – when ever I drag the column away from the HierarhicalGroupByControl in the TableView, when my mouse is over the GroupByControl in the view, it crash with the same stack trace and exception.

    I hope someone has found the solution.

    Imported from legacy forums. Posted by Sam (had 1965 views)

    User (Old forums)
    Member
    Post count: 23064

    Are you using “Run” element in the header? “Run” is not an Visual element. Xceed Drag Drop will not work on this. You to extend the HierarchicalGroupByControl and ColumnManagerRow and override the OnPreviewMouseMove and OnPreviewMouseLeftButtonDown in both the cases.

    Imported from legacy forums. Posted by Venkatesh (had 2908 views)

    User (Old forums)
    Member
    Post count: 23064

    I am using Run element in FooterRow, in Group-DataTemplate to provides my own styling. Though, I am not using <Run> explicitly…

    For example, I am doing this…

                    <xcdg:DataGridControl.View>
                        <xcdg:TableView FixedColumnCount=”1″>
                            <xcdg:TableView.FixedFooters>
                                <DataTemplate>
                                    <my:FooterRow>
                                        <TextBlock><TextBlock xml:space=”preserve”>Total </TextBlock><TextBlock Text=”{Binding RelativeSource={RelativeSource Self},Path=(xcdg:DataGridControl.StatContext).Total}” /><TextBlock xml:space=”preserve”> Items</TextBlock></TextBlock>
                                    </my:FooterRow>
                                </DataTemplate>
                            </xcdg:TableView.FixedFooters>
                        </xcdg:TableView>
                    </xcdg:DataGridControl.View>

    Whenever I am trying to unground by dragging a group header from the HierarchicalGroupByControl to the DataGrid, when I drag over the word “Total” or “Items” in the footer, because those are implicitly <Run> element, the DataGrid throw the exception posted above.

    Same thing happens on the customized Group DataTemplate.

    If the templates are like these

    <StackPanel><TextBlock /><TextBlock />…</StackPanel>

    then it works because no <Run> are created implicitly…but ya <Run> is still useful in some cases.

    But given that the Drag and Drop are just for Ungrouping or reordering the group, and it shouldn’t really care where the group item is dropped to when the dropped target is in the DataGrid but not the Headers…I hope this bug can be considered as valid and fixed subsequently.

    Imported from legacy forums. Posted by Sam (had 2957 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Sam,

    This issue has been fixed in the latest update of v3.1. Check it out.


    Fixed in version 3.1.9257.09450, which you can download in
    Updates section here:

    http://xceed.com/pages/TopMenu/Downloads/Updates.aspx?Lang=EN-CA

     

    Imported from legacy forums. Posted by Venkatesh (had 3279 views)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.