Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Binding Dependency Property to a user Setting

$
0
0

I have a simple class that is an Observable collection of DirectoryInfo.  It is just a list of path names that I display in a Listbox.  I define the object like this in the xaml

<local:MyCollection x:Key="MyFolders" DirectoryPath="C:\" />

I also have a user setting defined in the Settings.xml that stores the last selected root path.   

My.Settings.DirectoryPath = "C":\Folders"

I use the collection in the listbox like this.

<ListBox x:Name="MyList" ItemsSource="{StaticResource MyFolders}" />

I have a button that allows you to browse to a new Path and sets  My.Settings.DirectoryPath

I want bind my settings value to the DirectoryPath property of the collection so when the setting is changes the listbox contents change.

But I can't figure out how to do this?

 


Jeff Davis


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>