locked
WPF IsDefault=true property does not work if more than 2 buttons are used RRS feed

  • Question

  • I have a wpf window, in that window:

    If I have 2 buttons one set to IsDefault = true and the other Iscancel=true and when the user preesses on the enter key no new line is added and the OK btn clicked event is fired.

    BUT if have another button (now 3 buttons) the same behaviour does not work. I want this behaviour to work if I have more then 2 buttons.
    I have tried setting / unsetting the Isdefault property to no avail.

    Can anyone help please
    Wednesday, July 22, 2009 7:12 AM

Answers

  • Found the solution:

    The default value for the AcceptsReturn property is false for TextBox and true for RichTextBox.
    I had to set AcceptsReturn=false for all richtextbox controls and the OK click event is now fired.
    TO MICROSOFT --> Should the RichTextBox AcceptsReturn property default the same way as a Textbox - to be consistent?????
    Wednesday, July 22, 2009 11:01 PM

All replies

  • Found the solution:

    The default value for the AcceptsReturn property is false for TextBox and true for RichTextBox.
    I had to set AcceptsReturn=false for all richtextbox controls and the OK click event is now fired.
    TO MICROSOFT --> Should the RichTextBox AcceptsReturn property default the same way as a Textbox - to be consistent?????
    Wednesday, July 22, 2009 11:01 PM
  • A textbox is normally used to enter a single line of test. A rich textbox is more used to enter large portions of text, which includes new lines.

    That is why there is this difference.
    Ewald - Please remember to mark the replies as answers if they help.
    http://www.ewaldhofman.nl
    Thursday, July 23, 2009 5:06 AM