How do I add registry entries in a setup project ?
In the Solution explorer window, Select ’Setup project’ and Click on the ’Registry’ editor button at the top of the solution explorer window. In the Registry tree shown in the left pane, add necessary registry keys. In the right pane of the window, Right click and select ’New’ and ’Type’ of the value and enter the name of the value.
How do I pass data between pages in a NavigationWindow ?
In most of the web based applications, there is a need to pass data between pages in order to perform specific tasks. Data can be passed between pages in the NavigationWindow using the overloads of the ‘Navigate()’ method in the ‘NavigationService’ class. The following code snippet is used to pass data from one page to another. [C#] mypage newpage = new mypage(); window1.NavigationService.Navigate(newpage, empid); For this to work, mypage class should contain a constructor defined as follows. [C#] public mypage(string empid) { getempprofile(empid); }
How do I handle Back and Forward button click ?
Back and Forward button click can be handled using the ‘CommandBindings’ property of the ‘NavigationWindows’ class. The following code snippet is used to handle the ’Back’ button click in a NavigationWindow. [C#] //after InitializeComponent() navwindow1.CommandBindings.Add(new CommandBinding(NavigationCommands.BrowseForward, OnBrowseForward)); void OnBrowseBack(object sender, ExecutedRoutedEventArgs args) { MessageBox.Show(‘Back Button is Clicked’); }
How to set content of a NavigationWindow ?
NavigationWindow is a window with the ability to navigate between pages. NavigationWindow is one of the navigators in WPF, the other being the Frame. A navigator is the one which supports navigation and navigation history. The highlight of a NavigationWindow is that it can have it’s content as any of the .NET Framework 3.0 objects or HTML contents. ‘Source’ property of the NavigationWindow can be used to set the content of the NavigationWindow. [XAML] <NavigationWindow x:Class=’SampleTest.Window1′ xmlns=’http://schemas.microsoft.com/winfx/2006/xaml/presentation’ xmlns:x=’http://schemas.microsoft.com/winfx/2006/xaml’ Name=’window1′ Height=’300′ Width=’300′ Source=’http://www.google.com’>
How to navigate between pages in an application ?
Navigation in an application can be done in a pre-determined linear sequence, a user driven path through hierarchy or a dynamically generated path. Navigation can be performed using the following methods: Using Navigate method Navigate method in the Navigation service can be used to navigate to a page in the application. [C#] //Navigate using URI. this.NavigationService.Navigate(new Uri(‘mypage.xaml’, UriKind.Relative)); //Navigate to an instance of a page. mypage newpage = new mypage(); this.NavigationService.Navigate(newpage); Using Hyperlinks “NavigateUri” property of Hyperlink markup extension can be used to open a page using hyperlink. [XAML] <TextBlock> <Hyperlink NavigateUri=’mypage.xaml’>New Page</Hyperlink> </TextBlock> Using the journal Both navigation containers have a journal that records navigation history like a web browser. The journal maintains two stacks for ’Back’ and ’Forward’ stacks to record navigation.