Send email with wpf

后端 未结 3 1775
一个人的身影
一个人的身影 2021-02-10 14:38

Hi i am trying to send email in a wpf app but i get stuck; i show my xaml code

 
    
3条回答
  •  醉酒成梦
    2021-02-10 15:15

    If you are using codebehind, you don't need binding - although it's not very good pattern, it will of course work.

    Why don't you just name your textboxes (urlTextBox, subjectTextBox, etc.) and use these names in the button click event?

            Process.Start(string.Format("mailto:{0}?subject={1}&body={2}", urlTextBox.Text, subjectTextBox.Text, ... ));
    

    Of course this might easily fail, if user inputs invalid values.

    Using bindings is another way to go, but in this simple case I consider it overhead.

提交回复
热议问题