Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
swdev:dotnet:wpf:basic_controls [2013/01/22 14:25] smayr [WebBrowser] |
swdev:dotnet:wpf:basic_controls [2014/09/23 11:44] (current) smayr [Expander] |
||
---|---|---|---|
Line 373: | Line 373: | ||
VerticalAlignment=" | VerticalAlignment=" | ||
<Grid Background=" | <Grid Background=" | ||
- | <Grid.BitmapEffect> | + | <Border Margin=" |
- | <DropShadowBitmapEffect | + | BorderThickness=" |
- | </Grid.BitmapEffect> | + | <Border.Effect> |
+ | < | ||
+ | </Border.Effect> | ||
+ | </Border> | ||
< | < | ||
Line 1291: | Line 1294: | ||
</ | </ | ||
+ | '' | ||
+ | <code xml> | ||
+ | < | ||
+ | ToolTip=" | ||
+ | This is a long sentence with text. | ||
+ | </ | ||
+ | </ | ||
+ | Alternatively, | ||
== TextBox == | == TextBox == | ||
Line 1508: | Line 1519: | ||
</ | </ | ||
- | Execute a JavaScript routine from C#: | + | Execute a JavaScript routine from C#: (see more: [[http:// |
<code csharp> | <code csharp> | ||
- | // Fields | + | public class TSampleApp |
- | private WebBrowser aWebBrowser | + | { |
- | . . . | + | |
+ | private WebBrowser aWebBrowser; | ||
+ | . . . | ||
- | // Constructor | + | |
- | aWebBrowser.LoadCompleted -= new LoadCompletedEventHandler(aWebBrowser_LoadCompleted); | + | |
- | aWebBrowser.LoadCompleted += new LoadCompletedEventHandler(aWebBrowser_LoadCompleted); | + | { |
+ | aWebBrowser = new WebBrowser(); | ||
+ | | ||
+ | aWebBrowser.LoadCompleted += new LoadCompletedEventHandler(aWebBrowser_LoadCompleted); | ||
+ | } | ||
+ | |||
+ | public void LoadWebPage(string aWebPage) | ||
+ | { | ||
+ | // Load a webpage using Source property or Navigate() method | ||
+ | |||
+ | // Load an external website | ||
+ | aWebBrowser.Navigate(" | ||
+ | aWebBrowser.Navigate(new Uri(" | ||
+ | |||
+ | // Load a local file | ||
+ | aWebBrowser.Navigate(" | ||
+ | aWebBrowser.Source = new Uri(@" | ||
+ | |||
+ | } | ||
| | ||
- | void aWebBrowser_LoadCompleted(object sender, NavigationEventArgs e) | + | |
- | { | + | { |
- | // | + | // Call JavaScript routine after the document has been loaded completely |
- | // | + | // Example: |
- | string AppDir = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); | + | |
- | string ProdSpecPDFFilePath = " | + | // |
+ | string AppDir = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); | ||
+ | string ProdSpecPDFFilePath = " | ||
aWebBrowser.InvokeScript(" | aWebBrowser.InvokeScript(" | ||
- | | + | |
+ | } | ||
+ | </ | ||
+ | |||
+ | Sample HTML page with JavaScript to call: | ||
+ | <code js> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | |||
+ | <script type=" | ||
+ | function getAlert() | ||
+ | { | ||
+ | alert(" | ||
+ | } | ||
+ | window.onload = getAlert; | ||
+ | |||
+ | function LoadDoc(message){ | ||
+ | document.write(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | < | ||
+ | <input type=" | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
== Window == | == Window == |