[ C# ] AttachedProperties class
public static class AttachedProperties { public static readonly DependencyProperty BrowserSourceProperty = DependencyProperty . RegisterAttached ( "BrowserSource" , typeof ( string ) , typeof ( AttachedProperties ) , new UIPropertyMetadata ( null , BrowserSourcePropertyChanged ) ); public static string GetBrowserSource ( DependencyObject _DependencyObject ) { return ( string ) _DependencyObject . GetValue ( BrowserSourceProperty ); } public static void SetBrowserSource ( DependencyObject _DependencyObject , string Value ) { _DependencyObject . SetValue ( BrowserSourceProperty , Value ); } public static void BrowserSourcePropertyChanged ( DependencyObject _DependencyObject , DependencyPropertyChangedEventArgs _DependencyPropertyChangedEventArgs ) { WebBrowser _WebBrowser = _DependencyObject as WebBrowser; if ( _WebBrowser != null ) { string URL = _DependencyPropertyChangedEventArgs . NewValue as string; _WebBrowser . Source = URL != null ? new Uri ( URL ) : null; } } } [ C# ] ConnectionViewModel Class