GridView in UserControl

23 posts, 0 answers
  1. nbahl
    nbahl avatar
    25 posts
    Member since:
    Feb 2007

    Posted 22 Dec 2008 Link to this post

    I have a WPF UserControl that has a GridView on it, when I place that UserControl in a WinForm application and try grouping by dragging the column header into the Grouping area it errors out.  The error I get is:

    System.ArgumentNullException was unhandled
      Message="Value cannot be null.\r\nParameter name: otherVisual"
      Source="PresentationCore"
      ParamName="otherVisual"
      StackTrace:
           at System.Windows.Media.Visual.FindCommonVisualAncestor(DependencyObject otherVisual)
           at System.Windows.Media.Visual.TransformToVisual(Visual visual)
           at Telerik.Windows.Controls.DragDropManager.GetPopupPosition()
           at Telerik.Windows.Controls.DragDropManager.CreateDragAdorner()
           at Telerik.Windows.Controls.DragDropManager.PrepareElementToDrag(UIElement elementToDrag)
           at Telerik.Windows.Controls.DragDropManager.UIElement_MouseMove(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(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)
           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)
           at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
           at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
           at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at WinFormTestControl.Program.Main() in C:\rccdev\BankReconcilation\WinFormTestControl\Program.cs:line 18
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: 

    Any Ideas?

    Thanks,
    Nate

  2. Hristo Deshev
    Admin
    Hristo Deshev avatar
    559 posts

    Posted 23 Dec 2008 Link to this post

    Hello nbahl,

    I have reproduced the bug, and it occurs only when hosting RadGridView in a WinForms application. I managed to fix it in our development version. If that is a blocking issue for you, please open a separate support ticket to request an unofficial build that contains the fix.

    Thanks for the report! I have updated your Telerik points

    Regards,
    Hristo Deshev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. nbahl
    nbahl avatar
    25 posts
    Member since:
    Feb 2007

    Posted 29 Dec 2008 Link to this post

    Thank you for fixing so quickly.  Do you have an estimate on how long it will be before the next release is available?  If its going to be a couple weeks I can wait but if longer I might need to request an unofficial build.

    Thanks,
    Nate
  4. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 05 Jan 2009 Link to this post

    Hi nbahl,

    We have recently had our last release (December 17th) and the next one is a couple of months away. If that is inconvenient for you may open a support ticket and request an unofficial build.

    Kind regards,
    Milan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Ben
    Ben avatar
    6 posts
    Member since:
    Aug 2012

    Posted 15 Jan 2009 Link to this post

    We have received the unofficial build of RadGridView that fixed the bug when grouping in a RadGridView hosted in a WinForms application.  Grouping now works as it should in most cases, however, when the RadGridView is put inside of a <Viewbox> in this situation, and I try grouping again, I am now receiving an error    "Unable to cast object of type 'System.Windows.Media.ContainerVisual' to type 'System.Windows.UIElement'."

    Any ideas as to the cause of this error?

    Thanks
    Ben
  6. Jordan
    Admin
    Jordan avatar
    123 posts

    Posted 20 Jan 2009 Link to this post

    Hi Ben,

    This is another bug in our drag and drop. It is fixed and the new build is attached.

    Kind regards,
    Jordan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2009

    Posted 24 Apr 2013 Link to this post

    We have been using RadGridView grouping fine in a WinForms project all the way up until updating to 4.0 and upgrading our Telerik assemblies to that of 2013.1.403.40. Could this be a regression?

    System.ArgumentNullException occurred
      HResult=-2147467261
      Message=Value cannot be null.
    Parameter name: otherVisual
      Source=PresentationCore
      ParamName=otherVisual
      StackTrace:
           at System.Windows.Media.Visual.FindCommonVisualAncestor(DependencyObject otherVisual)
           at System.Windows.Media.Visual.TransformToVisual(Visual visual)
           at Telerik.Windows.Controls.UIElementExtensions.TransformToVisualSafe(UIElement target, UIElement element) in c:\TB\221\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\UIElementExtensions.cs:line 17
      InnerException:

  8. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 25 Apr 2013 Link to this post

    Hi Jeff,

    Thank you for the feedback.

    We were not able to reproduce the reported exception. Could you send us more details about your implementation or a sample project which shows the problem?
     
    Kind regards,
    Yordanka
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  9. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 24 Jun 2013 Link to this post

    Hi,
    I've got the same error today when im trying to sort a grid. My application is "hosting RadGridView in a WinForms application"

    Any idea how to fix it?
  10. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 25 Jun 2013 Link to this post

    Hi Lenka,

    Could you test your solution with the latest official version Q2 2013? Please let me know if the problem still persists.
     
    Regards,
    Yordanka
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  11. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 25 Jun 2013 Link to this post

    We are using the 2013.1.220.40 version

  12. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 26 Jun 2013 Link to this post

    Hello Lenka,

    The problem has been fixed with Q2 2013 official version.  Please give it a try and let us know if you find any problems.
     
    Regards,
    Yordanka
    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 >>
  13. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 26 Jun 2013 Link to this post

    Thank you.
    It works well with new version of dll's
  14. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 22 Aug 2013 Link to this post

    Now i found new bug. When i added  CanUserReorderColumns="True" to GridView, i've got problems with styles.
    Before column reordering i have a perfect grid with standart style (Windows8). But after the 2nd reorder the style changed to OfficeBlack.




    <telerik:RadGridView Grid.Row="1" 
    Margin="0"                            
    ItemsSource="{Binding LIST}"
     IsFilteringAllowed="True"
    SelectionMode="Extended" 
     CanUserResizeColumns="True"
    CanUserReorderColumns="True"
    AutoGenerateColumns="False"
    SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
     FilteringMode="Popup"
    DataLoaded="List_DataLoaded" 
     DistinctValuesLoading="OnDistinctValuesLoading"
     >
     <telerik:RadGridView.Columns>...

  15. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 22 Aug 2013 Link to this post

    I already tried add  telerik:StyleManager.Theme="Windows8Theme" or changed standard style, but it didnt fixed issue

    Could you tell me how can i rewrite Column Drag and Drop template for grid view?
  16. Nick
    Admin
    Nick avatar
    593 posts

    Posted 26 Aug 2013 Link to this post

    Hello Elena,

    Unfortunately this is an issue we have never encountered before. May I ask you to share a bit more info about the scenario? Do you have any custom styles? A sample project that isolates the problem would be very helpful! 

    Thank you in advance! 

    Regards,
    Nik
    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 >>
  17. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 26 Aug 2013 Link to this post

    sorry, i couldn't create a small project because for windows forms we used Infrajistic (maybe that the problem). 
    I almost fixed issue with reordering, but i still need help to rewrite standard DragAndDrop Column style. Could you tell me what template i should change?
  18. Nick
    Admin
    Nick avatar
    593 posts

    Posted 28 Aug 2013 Link to this post

    Hi Elena,

    Can you clarify what exactly do you mean by DragAndDrop Column style?

    Thank you in advance! 

    Regards,
    Nik
    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 >>
  19. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 28 Aug 2013 Link to this post

    I'm sorry. Template for Drag preview?

    like on the picture (for treeView) http://www.telerik.com/help/silverlight/media/RadTreeView-DragDrop-VisualElements.png

    Unfortunately we  could see DragPreview and DropPreview Line 




  20. Nick
    Admin
    Nick avatar
    593 posts

    Posted 02 Sep 2013 Link to this post

    Hi Elena,

    Unfortunately there is no way to do this out of the box. 

    The GrdView and TreeView are quite different and provide different level of User experience.

    Nevertheless there is a way to achieve what you want. 
    To change the DragVisual, you need to handle the DragInitialize event with HandledEventsToo set to true, where you can set the DragVisual to whatever you need it to be. 

    As to the PreviewDropLine, you can see how this can be done here.

    Hope this helps! 

    Regards,
    Nik
    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 >>
  21. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 15 Sep 2013 Link to this post

    I have a simple example with discussed problem. When i reorder column (the second time) I couldn't see DragPreview template.
    I can see its only for first time reordering.



    PS I disabled all my styles and used everything by default.

    PS I dont know how to attach zip file, so this is the link to http://www13.zippyshare.com/v/5204300/file.html
  22. Nick
    Admin
    Nick avatar
    593 posts

    Posted 18 Sep 2013 Link to this post

    Hi Elena,

    I took a look at your project, and after some debugging found out what goes wrong. 

    The DragVisual in WPF is contained in a WPF window, which is a new instance for every drag operation. 
    The thing is, that for some reason, once a WPF window has been opened in your application, you can never open another one. I trust this is an issue connected with the WinForms host application, that goes beyond our scope. 

    I am attaching a modified version of your project where you can see the problem I am referring to clearly. 

    Hope it helps! 

    Regards,
    Nik
    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 >>
  23. Lenka
    Lenka avatar
    11 posts
    Member since:
    Mar 2007

    Posted 19 Sep 2013 Link to this post

    Hi, Nik
    Thanks for the clarification and  good example. It looks weird and I guess we will spend lot of time to fixed it :(
    And thank you so much for all your help I really appreciate it.
Back to Top