Help with weird behaviour on propertycontrol

Jul 12, 2012 at 10:21 PM
Edited Jul 12, 2012 at 10:27 PM


I have a class that wraps up some settings see example below. When I set it as the propertycontrol.selected object I get a whole load of messages such as

System.Windows.Data Error: 40 : BindingExpression path error: 'InputLanguageManager' property not found on 'object' ''MainSettingsViewModel' (HashCode=35684727)'. BindingExpression:Path=InputLanguageManager.InputLanguage; DataItem='MainSettingsViewModel' (HashCode=35684727); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'InputLanguageManager' property not found on 'object' ''MainSettingsViewModel' (HashCode=35684727)'. BindingExpression:Path=InputLanguageManager.RestoreInputLanguage; DataItem='MainSettingsViewModel' (HashCode=35684727); target element is 'CheckBox' (Name=''); target property is 'IsChecked' (type 'Nullable`1')

Then I get to see the properties and values textboxes etc, in the categories I set on the control, but also a few other categories. The point is that when I select one of these other categories All the UI stuff disappears leaving just the DisplayName as text. I can set the required attribute to be Browseable and the other categories do not appear and the problem does not occur, but I still get all the error messages on the output pane of Sharpdevelop IDE. Any thoughts or suggestions or is it my code that is wrong


Sorry, did clean and recompiled with RequiredAttribute set to BrowseableAttribute and no longer get errormessages, but they return again when once RequiredAttribute is commented out.

This is the outline of my wrapper class


public class MainSettingsViewModel : DependencyObject, INotifyPropertyChanged
	public MainSettingsViewModel()
	void ReadMainSettings()
	DefaultLayoutName = Properties.Main.Default.DefaultLayoutFileName;
	public void Save()
	Properties.Main.Default.DefaultLayoutFileName = DefaultLayoutName;
	public static readonly DependencyProperty DefaultLayoutNameProperty =
			DependencyProperty.Register("DefaultLayoutName", typeof(string), typeof(MainSettingsViewModel),
			                            new FrameworkPropertyMetadata());
         [DisplayName("Layout Filename")]    
         public string DefaultLayoutName {
		get { return (string)GetValue(DefaultLayoutNameProperty); }
		set { SetValue(DefaultLayoutNameProperty, value); }

	public event PropertyChangedEventHandler PropertyChanged;
	protected void OnPropertyChanged(string name)
          PropertyChangedEventHandler handler = PropertyChanged;
          if (handler != null)
              handler(this, new PropertyChangedEventArgs(name));
Aug 21, 2012 at 1:06 PM

It seems like DependencyObject contains some properties that are not supported. Will add it to the issue tracker.

Using the RequiredAttribute should be a work-around.