Skip to content

YesNoQuestion Control

Iuga Alexandru edited this page Jan 7, 2018 · 1 revision

Description

The control displays a question and expects an answer of "yes" or "no".

Features

  • Customizable question text
  • Customizable keys for "Yes", "No", "Cancel" answers
  • Optional "Cancel" - Decide if the user is allowed to choose the "Cancel" answer.
  • Optional Default Answer - Specify a default answer that will be selected if the user presses "Enter".

Example

This is a simple yes/no control with no default value.

YesNoQuestion yesNoQuestion = new YesNoQuestion("Do you want to continue?");
YesNoAnswer answer = yesNoQuestion.ReadAnswer();

Result:

This is a yes/no/cancel control with a default value of 'Yes'.

YesNoQuestion yesNoQuestion = new YesNoQuestion("Do you want to continue?")
{
    AcceptCancel = true,
    DefaultOption = YesNoAnswer.Yes
};
YesNoAnswer answer = yesNoQuestion.ReadAnswer();

Result: