首页 > 解决方案 > ViewModel 中的 Properties.Settings.Default.Save() 是否可行?

问题描述

奇怪的是,但我不能让它在 ViewModel 中可用。

public class SmallWindow_ViewModel
{
public string My_property
        {
            get { return _my_property; }
            set { Set(ref _my_property, value); }
        }
        private string _my_property;


public void SmallWindow_unloaded()
        {

            Properties.Settings.Default.My_property_setting = My_property;

            Properties.Settings.Default.Save();
        }
}

如果将它放在代码后面,它就可以工作。

标签: c#wpfviewmodel

解决方案


推荐阅读