示例#1
0
 private void btApply_Click(object sender, RoutedEventArgs e)
 {
     foreach (KeyValuePair <NamedValueListControl, ApplicationSettingsBase> binding in SettingsVisualBinding)
     {
         NamedValueListControl   visual = binding.Key;
         ApplicationSettingsBase settingsDefaultInstance = binding.Value;
         foreach (NamedValuePair item in visual.Items)
         {
             settingsDefaultInstance[item.Name] = item.Value;
         }
     }
 }
示例#2
0
 private void InitLists()
 {
     foreach (KeyValuePair <NamedValueListControl, ApplicationSettingsBase> binding in SettingsVisualBinding)
     {
         NamedValueListControl   visual = binding.Key;
         ApplicationSettingsBase settingsDefaultInstance = binding.Value;
         visual.Items.Clear();
         foreach (SettingsPropertyValue item in settingsDefaultInstance.PropertyValues)
         {
             visual.Items.Add(new NamedValuePair(item.Name, item.PropertyValue,
                                                 item.Property.Attributes.ContainsKey(typeof(ApplicationScopedSettingAttribute)))); //if the setting is application scope than it cannot be modified by the user
         }
     }
 }