RadPivotFieldList Drag&Drop Loose Custom Name

7 posts, 1 answers
  1. Stefania
    Stefania avatar
    127 posts
    Member since:
    May 2013

    Posted 24 Nov 2017 Link to this post

    Hi,

    On my fields list I setting a custom display name.

    When I dragged field from field list and I dropped to reportfilter/column label/ row label or values it keep the right name.

    But when I drag field between reportfilter, column label, row label and values the dragged item show the Property name instead of the Display Name (see the attachment)

    How can I fix it?

    Thank you

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    654 posts

    Posted 29 Nov 2017 Link to this post

    Hello Stefania,

    I tried to reproduce the issue you've described in a sample project but was, unfortunately, unable to do so. I'm attaching the project I've used in the process to my reply.

    Could you please have a look at it and let me know how I can modify it so that the undesired behavior is observed? Please note that I've set the DisplayName for the Date and Product properties and dragging their respective fields in the RadPivotFieldList displays the DisplayName

    Thank you in advance for your cooperation on the matter.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Stefania
    Stefania avatar
    127 posts
    Member since:
    May 2013

    Posted 01 Dec 2017 Link to this post

    Hi,

    I modified your demo to reproduce the error, now the code is similar to our application.

    1. Field list is generated runtime because we'll use dynamic linq

    2. We can't use DisplayName on the property of the object

     

    Drag Product Name from Rows section. On dragged tooltip will display Product.

    I open a new ticket with your project modified
    ticket ID: 1143008

    Thank you

  4. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    654 posts

    Posted 05 Dec 2017 Link to this post

    Hello,

    I'm also posting the recommended approach for such a scenario that I suggested in the support ticket so that it is beneficial to the community:

    "To achieve the desired result you will need to create a custom RadPivotFieldList and add a handler for the DragInitialize event."

    public class CustomPivotFieldList : RadPivotFieldList
    {
        public CustomPivotFieldList()
        {
            DragDropManager.AddDragInitializeHandler(this, new DragInitializeEventHandler(OnDragInitialize), true);
        }
      
        private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            var item = e.OriginalSource as FieldBoxItem;
            if (item != null)
            {
                DescriptionWrapper context = item.DataContext as DescriptionWrapper;
      
                if (context != null)
                {
                    var text = ((FieldInfoNode) ((RadPivotFieldList) sender).DataProvider.FieldInfos.RootFieldInfo.Children.First(x => x.Name == context.FieldInfo.Name)).FieldInfo.DisplayName;
                    e.DragVisual = new TextBlock() { Text = text };
                }
            }
        }
    }

    I hope this is helpful.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Stefania
    Stefania avatar
    127 posts
    Member since:
    May 2013

    Posted 21 Dec 2017 Link to this post

    Hi,

    one more question,

    keep using my previous project attached on ticket.

    I'm trying to add calculated fields code behind and I should use class CalculatedPivotFieldInfo but it's inaccessible.

     

    How can I do?

    Thank you

  6. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    654 posts

    Posted 22 Dec 2017 Link to this post

    Hello,

    Indeed, the CalculatedPivotFieldInfo is marked as internal and is not accessible. Could you please, however, specify why you need to use this class in this scenario?

    I've updated the project to include a calculated field, and have specified a custom DisplayName for it. Could you please have a look and let me know if this is what you have in mind or if there's something else I'm missing?

    I look forward to your reply.

    Regards,
    Dilyan Traykov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  7. Stefania
    Stefania avatar
    127 posts
    Member since:
    May 2013

    Posted 27 Dec 2017 in reply to Dilyan Traykov Link to this post

    Hi Dilyan,

    Thank you your reply. It works.

    I was thinking I had to use the CalculatedPivotFieldInfo but if this is the better way to accomplish my request it's ok.

    Thank you

Back to Top