How to bind WPF controls to Application settings

Posted by SunKwon Kim on 2009/04/08 23:43
Filed under WPF
Tags : ,

When to bind WPF controls to settings


At Sometimes, i want to show program verion in my application. And I wrote it in Application settings ("Settings.Settings"). How could I do that? If we don't know how to bind it, we have to write twice at each time upgrading our programs. Jerome Laban and Michael jp posted how to do that with different approaches.


Method 1: using resource declaration


I simplify the method 1. First, write a string you want to show like this.

Secondly, add namespace for application settings. and declare a setting object in the resource

Lastly, bind a control to the Settings object like this.


Method 2: using x:Static keyword


Or if you want to bind it as a static, just do like this.
First, declare the namespace for application settings. it is the same with method 1.
Second, bind the control to the settings using x:Static keyword like this.


2009/04/08 23:43 2009/04/08 23:43
Trackback URL >> http://crowsley2.cafe24.com/trackback/32
Leave a comment
[Log-ing][What is OpenID?]