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 [2012/10/12 12:04] smayr [Timer] |
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 1132: | Line 1135: | ||
< | < | ||
| | ||
- | | + | |
+ | | ||
< | < | ||
< | < | ||
Line 1142: | Line 1146: | ||
</ | </ | ||
</ | </ | ||
- | |||
== RadioButton == | == RadioButton == | ||
Line 1291: | Line 1294: | ||
</ | </ | ||
+ | '' | ||
+ | <code xml> | ||
+ | < | ||
+ | ToolTip=" | ||
+ | This is a long sentence with text. | ||
+ | </ | ||
+ | </ | ||
+ | Alternatively, | ||
== TextBox == | == TextBox == | ||
Line 1454: | Line 1465: | ||
In WPF, '' | In WPF, '' | ||
- | < | + | < |
- | // using System.Windows.Threading; | + | void ActivateTimer() |
- | DispatcherTimer timer = new DispatcherTimer(); | + | { |
- | timer.Interval = TimeSpan.FromSeconds(100); | + | |
- | timer.Tick += new EventHandler(timer_Tick); | + | DispatcherTimer timer = new DispatcherTimer(); |
- | timer.Start(); | + | timer.Interval = TimeSpan.FromSeconds(10); // 10 seconds |
+ | timer.Tick += new EventHandler(timer_Tick); | ||
+ | timer.Start(); | ||
+ | } | ||
+ | |||
+ | void timer_Tick(object sender, EventArgs e) | ||
+ | { | ||
+ | // Do something every tick | ||
+ | } | ||
</ | </ | ||
== URI == | == URI == | ||
Line 1492: | Line 1511: | ||
{ | { | ||
// Local web page | // Local web page | ||
+ | // NOTE: Use siteoforigin for local files. | ||
+ | // | ||
+ | // More Reading: http:// | ||
// | // | ||
| | ||
} | } | ||
+ | </ | ||
+ | |||
+ | Execute a JavaScript routine from C#: (see more: [[http:// | ||
+ | <code csharp> | ||
+ | public class TSampleApp | ||
+ | { | ||
+ | // Fields | ||
+ | private WebBrowser aWebBrowser; | ||
+ | . . . | ||
+ | |||
+ | // Constructor | ||
+ | public TSampleApp() | ||
+ | { | ||
+ | aWebBrowser = new WebBrowser(); | ||
+ | aWebBrowser.LoadCompleted -= new LoadCompletedEventHandler(aWebBrowser_LoadCompleted); | ||
+ | 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 = " | ||
+ | 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 == |