开发者

FontFamilly, FontSize, Color..settings in WPF app

what is the best way for create settings (user can choose own font size, font family, color of text) in WPF app with MVVM design?

My ides is create setting class. An this class store/load from database when is wpf loading/closing. E开发者_StackOverflowxport this class with MEF and inject in view models classes and this properties of this setting class bind in view.

Something like this.

[Export(typeof IMySettings)]
public class MySetting : IMySettings
{
  //bind in view
  public FontFamily MyViewFont
  {
     get{return _myViewFont;}
     set
     {
        _myViewFont=value;
     }
  }

What do you think about it? }


Settings class is fine. I myself call it a SettingsService but that doesn't matter. To save settings you can use the built-in support of .NET.

You can read more about it here. Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜