Hello,
I'm using a custom SettingsPane based on the one you developped (Telerik\UI for WPF R2 2017\Themes.Implicit\WPF40\Windows7\Themes). This pane is used to customize all of the shapes (basic RadShapes and custom shapes) in a RadDiagram.
In this pane, there is a tab (it content is a UserControl) which allows the user to add values (from a RadGridView) to a serie in a RadChart (ScatterChart). The RadGridView allows the copy/paste functionnality to paste some values from Excel (for example).
However, I have a strange behavior about the focus: if I open the pane and the dedicated tab, I go to Excel to copy the data, click on the RadGridView before paste the data, then the main window and the pane don't take the focus. On the contrary, if I copy the data before opening the pane and the tab, there aren't any problems with the focus, the pasting is correctly done.
When the problem occurs, we can see that the main window header is light grey, to indicate that it doesn't have the focus.
Do you know something about this behavior? Do you have any solution?
Many thanks.
Valentin.
I'm afraid I cannot pinpoint an exact cause and suggest a viable solution for this behavior without being able to replicate it at my end. Would you find it possible to isolate this in a small sample project so that I can further assist you?
Hi Dilyan,
Sadly, I can't give you a sample part of the code because the project is too big and there are some sensitive data...
Do you know if exist somethings to force a focus to a parent after click on the RadGridView or any composant as described?
Thank you.
Valentin.
I'm afraid I cannot suggest a viable solution without being able to test it at my end. You can, however, try the approach suggested in this thread: WPF-MVVM: Setting UI control focus from ViewModel.
If that does not work, I can suggest trying to reproduce this in a new isolated project. The sensitive data can be replaced with dummy data as this will most probably be irrelevant to the issue. The main goal would be to replicate the same setup and layout. Do let me know if you would find this possible.
Hi Dilyan,
You can find below a link to download a sample project allowing you to reproduce my issue.
https://we.tl/t-Y6VS7ajPGH -> The link is available only one week.
Steps to reproduce:
- Click on the shape
- Click on the settings button
- Click on the textbox
- Change window (to copy data from Excel/Gsheet for example)
- Click on the textbox again
- Try to paste clipboard or right something: the focus isn't on the main window/textbox but on the other window.
Thank you for your help.
Valentin.
Thank you very much for the provided sample project. I can confirm that I was able to replicate the issue, however, it seems to stem from the WPF framework rather than the implementation of the RadDiagram control. You can notice that the default settings pane closes when the parent window loses the focus and this is by design.
I was able to replicate the same issue using only native WPF controls and am attaching an updated version of your project which demonstrates this. You can notice that the focus cannot be brought to the TextBox unless the parent window is focused.
With this said, I can suggest forwarding your inquiry to the MSDN and/or StackOverflow forums to get further assistance on whether it would be possible to achieve the desired result.
I hope you find this information helpful.
Hi Dilyan,
Thank you for analysis and your feedback. I wrote a question on StackOverflow using your sample projet, I hope I'll have a solution!
https://stackoverflow.com/questions/71392416/why-mainwindow-doesnt-take-the-focus-from-a-popup-child
Many thanks,
Valentin