Bug: Diagram content not updated in settings pane if invoked directly from edit mode

0 Answers 48 Views
Diagram
Mrugendra
Top achievements
Rank 1
Iron
Mrugendra asked on 04 Apr 2022, 05:19 AM

Hi,

We are having  an issue with the settings pane of the diagram control wherein if we add a shape to the diagram, edit its text, and click on the settings pane directly, the content (text) of the control is not reflected in the settings pane text tab. Also, any change that you make, say to text or fonts etc. is not immediately reflected on the control. This is causing a great deal of confusion to our users.

How do we force the settings pane to pick up the latest value from the control and make sure it applies changes immediately (so they are visible to the user as they make them)?

I have attached a video demonstrating this issue: https://somup.com/c3ffh2O1kO

Please help.

 

Dilyan Traykov
Telerik team
commented on 04 Apr 2022, 01:02 PM

Hi Mrugendra,

Thank you very much for the provided video.

Indeed, I can agree that the described behavior is counterintuitive. To avoid the text of the diagram being edited in two separate places simultaneously, however, a possible fix would be to commit the edit operation when opening the settings pane. Would such an approach be suitable for you?

Mrugendra
Top achievements
Rank 1
Iron
commented on 04 Apr 2022, 01:08 PM

Hi Dilyan,

Thank you for the quick reply.  Yes, indeed.  That is frankly what we are looking for, to commit the changes before opening the settings pane so that the user gets a smooth experience and does not get confused. 

This is a critical matter, our project is currently stuck on this one matter. I hope you can share a way for us to achieve the commit before opening the settings pane behavior. 

Thanks again.

Mrugendra
Top achievements
Rank 1
Iron
commented on 05 Apr 2022, 04:45 AM

Hi Dilyan,

From our own assessment and your kind advice, we did manage to achieve the "end edit mode" and refresh the settings pane.  I wanted to share the code with you in case you could recommend enhancements.


//Inserted in the constructor. diagram_settings is the x:Name of the SettingsPaneView
diagram_settings.Loaded += Diagram_settings_Loaded;

private void Diagram_settings_Loaded(object sender, RoutedEventArgs e)
        {
                var t = diagram_settings.Template;
                var chld = (RadToggleButton)t.FindName("ToggleButton", diagram_settings);
                if(chld != null) chld.Checked += Chld_Checked;             
        }

private void Chld_Checked(object sender, RoutedEventArgs e)
        {
            var editItems = diagram.SelectedItems.Where(itm => !((itm as RadDiagramShapeBase) is null) && (itm as RadDiagramShapeBase).IsInEditMode);

            if (editItems.Count() == 0) return;

            editItems.ForEach(itm =>
            {
                if ((itm as RadDiagramShapeBase) is null)
                    return;
                (itm as RadDiagramShapeBase).IsInEditMode = false;                
            });
            
            var chld = sender as RadToggleButton;
            chld.IsChecked = false;
            chld.IsChecked = true;
        }

Thanks.

 

Martin Ivanov
Telerik team
commented on 07 Apr 2022, 06:18 AM

Thank you for sharing your code.

No answers yet. Maybe you can help?

Tags
Diagram
Asked by
Mrugendra
Top achievements
Rank 1
Iron
Share this question
or