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/02/10 15:56] smayr [TextBox] |
swdev:dotnet:wpf:basic_controls [2014/09/23 11:44] (current) smayr [Expander] |
||
---|---|---|---|
Line 189: | Line 189: | ||
<code csharp> | <code csharp> | ||
myButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); | myButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); | ||
+ | </ | ||
+ | |||
+ | Tooltips on a button: | ||
+ | <code xml> | ||
+ | <Button Content=" | ||
+ | | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
More Creative: | More Creative: | ||
* [[swdev: | * [[swdev: | ||
- | |||
== Cursor == | == Cursor == | ||
Line 361: | Line 373: | ||
VerticalAlignment=" | VerticalAlignment=" | ||
<Grid Background=" | <Grid Background=" | ||
- | <Grid.BitmapEffect> | + | <Border Margin=" |
- | <DropShadowBitmapEffect | + | BorderThickness=" |
- | </Grid.BitmapEffect> | + | <Border.Effect> |
+ | < | ||
+ | </Border.Effect> | ||
+ | </Border> | ||
< | < | ||
Line 1120: | Line 1135: | ||
< | < | ||
| | ||
- | | + | |
+ | | ||
< | < | ||
< | < | ||
Line 1130: | Line 1146: | ||
</ | </ | ||
</ | </ | ||
- | |||
== RadioButton == | == RadioButton == | ||
Line 1279: | Line 1294: | ||
</ | </ | ||
+ | '' | ||
+ | <code xml> | ||
+ | < | ||
+ | ToolTip=" | ||
+ | This is a long sentence with text. | ||
+ | </ | ||
+ | </ | ||
+ | Alternatively, | ||
== TextBox == | == TextBox == | ||
Line 1438: | Line 1461: | ||
</ | </ | ||
+ | == Timer == | ||
+ | |||
+ | In WPF, '' | ||
+ | |||
+ | <code csharp> | ||
+ | void ActivateTimer() | ||
+ | { | ||
+ | // using System.Windows.Threading; | ||
+ | DispatcherTimer timer = new DispatcherTimer(); | ||
+ | timer.Interval = TimeSpan.FromSeconds(10); | ||
+ | timer.Tick += new EventHandler(timer_Tick); | ||
+ | timer.Start(); | ||
+ | } | ||
+ | |||
+ | void timer_Tick(object sender, EventArgs e) | ||
+ | { | ||
+ | // Do something every tick | ||
+ | } | ||
+ | </ | ||
== URI == | == URI == | ||
Line 1449: | Line 1491: | ||
More information: | More information: | ||
- | |||
== WebBrowser == | == WebBrowser == | ||
Line 1470: | 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 == |