public FolderOpenControl() { var foc = new FolderOpenCommand(); this.SetValue(FolderOpenCommandProperty, foc); foc.PropertyChanged += (sender, e) => { if (e.PropertyName == "Directory") { this.Dispatcher.InvokeAsync(() => Path = foc.Directory, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken)); } }; }
public FolderOpenControl() { var foc = new FolderOpenCommand(); this.SetValue(FolderOpenCommandProperty, foc); Uri resourceLocater = new Uri("/UtilityWpf.View;component/Themes/FolderOpenControl.xaml", System.UriKind.Relative); ResourceDictionary resourceDictionary = (ResourceDictionary)Application.LoadComponent(resourceLocater); Style = resourceDictionary["FolderOpenControl"] as Style; foc.PropertyChanged += (sender, e) => { if (e.PropertyName == "Directory") { this.Dispatcher.InvokeAsync(() => Path = foc.Directory, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken)); } }; }