1、Xmal中引入命名空间- xmlns:Properties="clr-namespace:CodeGenerator.Properties"
复制代码 2、绑定控件属性- <TextBox Text="{Binding Path=connstr, Mode=TwoWay, Source={x:Static Properties:Settings.Default}}" />
复制代码 3、退出程序更新Settings- private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- Settings.Default.Save();
- }
复制代码 |