locked
UI becoming unresponsive after pressing Copy button

    Question

  • I have a RichEditBox and a button upon which tapping, the selected text gets copied...this innocent looking code was working very nicely a few days ago...but 2day when i checked, it was making the ui unresponsive...plzz help

    editor is RichEditBox

    private void copy_btn_Tapped(object sender, TappedRoutedEventArgs e)
            {
                //Just being extra safe
                if (editor.Document.Selection.Length != 0)
                {
                    editor.Document.Selection.Copy();
                    editor.Focus(FocusState.Programmatic);
                }
            }

    Saturday, January 03, 2015 6:18 PM

All replies

  • This is driving me nuts. Why ain't anybody replying It has been around 24hrs now?
    Sunday, January 04, 2015 4:55 PM
  • It is not only a weekend: it is a holiday weekend. Most people probably aren't watching the forums. 

    You will need to provide more information about the problem. Your code looks fine, The problem probably isn't in it. What exactly is the nature of the unresponsiveness? Is the app deadlocked? hung in a loop? UI disabled? 

    What did you find when you debugged the app? Can you reproduce this in a minimized repro app? If so, then share it on your OneDrive and somebody may be able to help you debug.

    (Note: I will be out of the office and probably unable to help until after next week, but somebody else on the community may be able to help if you can provide sufficient information to work with).

    Sunday, January 04, 2015 6:17 PM
    Owner
  • This is driving me nuts. Why ain't anybody replying It has been around 24hrs now?

    Because nothing changed in your code. But suddenly, as if demonic possession has taken over your app, the UI has become unresponsive.

    That happens all the time in threads. Usually the thread originator at some later point goes "Oh I forgot I did this or that" and the thread ends with them correcting "this or that".

    Also nobody gets paid to provide you assistance in these Forums. Or works on these forums 24/7.

    Then you say that code you display is somehow the issue. How would you know that? Did you time that code to see when it starts and finishes?

    So you display a little bit of code then provide no possible knowledge on how you know that is what is causing the UI to become unresponsive.

    Now you have a reply. No doubt you will not like it.

    Also bumping threads in forums shows poor forum etiquette.


    La vida loca


    Sunday, January 04, 2015 6:30 PM
  • Also I see nothing that looks like your code with regard to a RichTextBox  Windows Controls: The Rich Text Box at any of the many links I've looked at since I initially read your first post. Other than possibly automating MS Word and using possibly VBA code.

    Since you display not other code regarding this RTB anything would be a guess.


    La vida loca

    Sunday, January 04, 2015 6:52 PM
  • Hi RahulRanjan123, are you using a third party control?
    Monday, January 05, 2015 5:09 AM