-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBrowserBehavior.cs
More file actions
33 lines (29 loc) · 1.31 KB
/
Copy pathBrowserBehavior.cs
File metadata and controls
33 lines (29 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Windows;
using System.Windows.Controls;
namespace PSO2ModManager
{
public class BrowserBehavior
{
public static readonly DependencyProperty HtmlProperty = DependencyProperty.RegisterAttached(
"Html",
typeof(string),
typeof(BrowserBehavior),
new FrameworkPropertyMetadata(OnHtmlChanged));
[AttachedPropertyBrowsableForType(typeof(WebBrowser))]
public static string GetHtml(WebBrowser d) {
return (string)d.GetValue(HtmlProperty);
}
public static void SetHtml(WebBrowser d, string value) {
d.SetValue(HtmlProperty, value);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Windows.Controls.WebBrowser.NavigateToString(System.String)")]
private static void OnHtmlChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) {
WebBrowser webBrowser = dependencyObject as WebBrowser;
var value = " ";
if (System.String.IsNullOrEmpty(e.NewValue as string))
value = e.NewValue as string;
if (webBrowser != null)
webBrowser.NavigateToString(value);
}
}
}