diff options
Diffstat (limited to '')
-rw-r--r-- | src/WixToolset.WixBA/BrowserProperties.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/WixToolset.WixBA/BrowserProperties.cs b/src/WixToolset.WixBA/BrowserProperties.cs new file mode 100644 index 00000000..f40d4ed9 --- /dev/null +++ b/src/WixToolset.WixBA/BrowserProperties.cs | |||
@@ -0,0 +1,40 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.UX | ||
4 | { | ||
5 | using System.Windows; | ||
6 | using System.Windows.Controls; | ||
7 | |||
8 | /// <summary> | ||
9 | /// Dependency Properties to support using a WebBrowser object. | ||
10 | /// </summary> | ||
11 | class BrowserProperties | ||
12 | { | ||
13 | /// <summary> | ||
14 | /// Dependency Propery used to pass an HTML string to the webBrowser object. | ||
15 | /// </summary> | ||
16 | public static readonly DependencyProperty HtmlDocProperty = | ||
17 | DependencyProperty.RegisterAttached("HtmlDoc", typeof(string), typeof(BrowserProperties), new PropertyMetadata(OnHtmlDocChanged)); | ||
18 | |||
19 | public static string GetHtmlDoc(DependencyObject dependencyObject) | ||
20 | { | ||
21 | return (string)dependencyObject.GetValue(HtmlDocProperty); | ||
22 | } | ||
23 | |||
24 | public static void SetHtmlDoc(DependencyObject dependencyObject, string htmldoc) | ||
25 | { | ||
26 | dependencyObject.SetValue(HtmlDocProperty, htmldoc); | ||
27 | } | ||
28 | |||
29 | /// <summary> | ||
30 | /// Event handler that passes the HtmlDoc Dependency Property to MavigateToString method. | ||
31 | /// </summary> | ||
32 | /// <param name="d"></param> | ||
33 | /// <param name="e"></param> | ||
34 | private static void OnHtmlDocChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
35 | { | ||
36 | var webBrowser = (WebBrowser)d; | ||
37 | webBrowser.NavigateToString((string)e.NewValue); | ||
38 | } | ||
39 | } | ||
40 | } | ||