Bind to User.Settings

2 posts, 0 answers
  1. Garry
    Garry avatar
    205 posts
    Member since:
    Nov 2010

    Posted 22 Mar 2010 Link to this post

    Hey guys,
    I am trying to use a RadComboBox to bind to a Specialized.StringCollection in my User.Settings. I am able to load the ComboBox from the collection, but the twoway binding does not seem to work. Is this possible with just stright XAML binding or do I need to create a whole class to accomodate this? I have the twoway binding working for my Window properties so I do know that I appear to have my ResourceDictionary configured correctly. Below is what I have so far.

    XAML
    <telerikInput:RadComboBox x:Name="comboTheme" ItemsSource="{Binding Source={StaticResource settings}, Path=Default.Theme}" 
                            SelectedItem="{Binding Default.Theme, Mode=TwoWay}"/> 

    App.Config
    <userSettings>       
        <EliteExtender.Shell.Properties.Settings> 
          <setting name="MainWidth" serializeAs="String">  
            <value>800</value> 
          </setting> 
          <setting name="MainHeight" serializeAs="String">  
            <value>625</value> 
          </setting> 
          <setting name="MainState" serializeAs="String">  
            <value /> 
          </setting> 
          <setting name="Theme" serializeAs="Xml">  
            <value> 
              <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">  
                <string>Office_Blue</string> 
                <string>Office_Black</string> 
                <string>Office_Silver</string> 
                <string>Summer</string> 
                <string>Vista</string> 
                <string>Windows7</string> 
              </ArrayOfString> 
            </value> 
          </setting> 
        </EliteExtender.Shell.Properties.Settings> 
      </userSettings> 

    ResourceDictionary (registered in App.Xaml)
    <ResourceDictionary  
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:settings="clr-namespace:EliteExtender.Shell.Properties">  
        <ResourceDictionary.MergedDictionaries> 
            <ResourceDictionary> 
                <settings:Settings x:Key="settings" /> 
            </ResourceDictionary> 
        </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 23 Mar 2010 Link to this post

    Hello Garry,

    RadComboBox should work in such scenarios, I guess that there is a problem with the bindings that are applied on the control. For example, looking at your code snippets, I guess that there is something strange - RadComboBox ItemsSource is bound to a property called Default.Theme, which I guess is some kind of collection; the SelectedItem property is also bound to Default.Theme - I suppose you should be binding to something else, if this property is the same as the ItemsSource's source. A simple application that could be used to observe the problem would be of great help, so I would like to kindly ask you to create one and send it to us through a new support ticket.

    Kind regards,
    Valeri Hristov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top