LoginSignup
1
0

More than 3 years have passed since last update.

XAMLにシングルトンをバインディング

Posted at

下記のようなシングルトンがあった場合

シングルトン
namespace test
{
    public class Setting {
        static Setting instance = new Setting();
        static public Setting I { get{ return instance; } }

        public double Font_Size { get; set; }
    }
}

下記のようにバインディングします。

xaml
<UserControl x:Class="test.ucInput"
         xmlns:local="clr-namespace:test"
>
........

<Setter Property="FontSize" Value="{Binding Font_Size, Source={x:Static local:Setting.I}}"/>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0