Home>

After a little research, I found System.Windows.DialogResultConverter. Windows Forms DialogResult and WPF DialogResult are different, so I looked at the source twice to see if it converts it or whether it converts a string and bool?

DialogResultConverter.cs

What is this used for?
Searching on Google will not hit. Does anyone know anyone?

  • Answer # 1

    GitHub has only examples of using this pattern.

    [TypeConverter (typeof (DialogResultConverter))]
    public NullableDialogResult {get;set;}

    I suppose the reason is that I don't want to set a value on xaml, so I'm trying to make an error on purpose.
    In addition to We don't support, I want you to write why too.

    If you specifyDialogResult = "True"on xaml as a trial,

      

    DialogResult property cannot be set in markup or serialized to a string.

    I got an error like

    . It seems to correspond toSRID.CantSetInMarkup.

    However,DialogResult = "{x: Null}"gave another error.

      

    The DialogResult can only be set after the Window has been created and displayed as a dialog.

    Is the route different?~ I'm not sure.~
    Window.cs
    Line 1451 seems to correspond toSRID.DialogResultMustBeSetAfterShowDialog.
    I don't feel like searching for why ^^;

Related articles