Add a new page at runtime in WPF on button click - wpf

In my application I need to create a new XAML page/usercontrol at runtime. The use case is like:
User Clicks on add page button on the main window.
A new XAML page gets added to the application.
User can design the page by adding controls from a custom tool bar and save the page.
User can also add event handler to navigate between pages.
Please let me know how can I go about this.

Related

Dynamically "Delete" Icon hide show in in kendo scheduler

I have create new event in kendo scheduler.There is some problems in my scheduler.I want to show delete button only authorize person who is created this event.And I want to hide delete button who is not created this event,Only show event scheduler and hide icon.
I am so tired but not solved this problems please help
I think that you need to create different types of users and give them different perks. For example, the person who created that event will be an administrator. You have to create some function where the administrator will have the create and the destroy properties as true. To other users, you'll set those properties false. As for the hiding or not buttons, I suggest you to make your own custom edit form template. This was just a general idea but I hope you get the bigger picture.
updated answer:
Not only I think you should implement the CRUD operations manually but also customize the Scheduler behavior. Just like you can wire edit event and hide the save button if an user is not authorized or just like you can wire a save event and control wheather you allow or not event modifications, the same can be made with a delete event. Anyway, from what I understood, I think that using a custom editor template to control the state of any components should be enough. Basically, define a custom template and allow/disable/hide/show some widgets depending on the user that is logged in. The credentials can be loaded and used directly in the template. Check this dojo, it might be useful.

ExtJS load views dynamically for dashboard widgets

In my ExtJS 4.2.1 Application I have a dashboard screen where Im showing some charts and grids.
I have been requested by my client to allow the user to add custom widget (from a static collection of widgets) so the dashboard will only show the widgets that the user wants to have.
So I have to create the widgets dynamically depending on some JSON that I will send from server when the user logins. But i have no idea how to implement this.
The process that the user will follow will be the following:
On my dashboard view I will have 4 panels (table layout).
Each panel will have a tool (gear icon).
The user clicks on this gear icon and a window will be shown with a list of available widgets he can assign to that panel.
The user selects the widget that he wants to add to the selected panel and he pressed the button "Apply".
On button clicked event the preferences will be saved on database.
The next time the user logins in to the app, the preferences will be loaded into the initial JSON so the widgets can be loaded into each panel.
Does anyone have implemented this kind of approach?
I will try to explain for a single panel then u can extend/use that on multiple panels(may be using tbl layout). Say we have some charts view files already created(for this ref charts tutorial on extjs docs), The charts files should have a config (custom config) through that we will pass the real time/dynamic data requied by the chart.
So For first time we will allow user to select chart/widget options from list we we will create chart/widget on its select event as well as save the name of the widget or any other extra settings provided in that widget along with user details in database.
Next time when user logs in we have to retrieve the widget name etc from db and create a widget dynamically on page laod event and display.
Hope this clarify your understanding.

WPF Navigating From one page to another inside a window

I am trying to write a WPF application. The general outline of the application is as follows: There is a main window(Note that the main window is a full screen application) and there are several pages(Possibly 25) and I want to navigate from one page to another with a button click event on each page. What will be the best way to achieve this?
I have tried creating a Frame on the MainWindow and then use the frame to display pages, but my problem is that I can not navigate from one page to another from a button click on the pages. I am new to this and I would appreciate any help.
You could of at least tried a Google mate, this information is abundant, but because you thought typing a paragraph here was easier, I shall save you the trouble.... http://paulstovell.com/blog/wpf-navigation

Tab control in Silverlight 3.0 and Dirty data

We are using tab control in our project. While using this control i came across a few issues like
- When the tab control loads, it invokes constructor of all the xaml pages that form the individual tabs. Can this be avoided?
Is there any event with tab control that we can use to identify dirty data on the previous tab that i may have visited. I mean can i prevent user from navigating to some other tab before saving the changes on current tab.
You should be able to avoid the instantiation of each xaml page in the individual tabs by adding the content to the tabs dynamically, right before they are shown for the first time. You might be able to get away with doing this on the tab control's SelectionChanged event.
The tab control does not have a dirty state management. At best, you individual containers/pages will have to handle the dirty state.
I mean can i prevent user
from navigating to some other tab
before saving the changes on current
tab.
I don't think you can prevent it. We have something similar in our app and the route we have chosen is if the page is validated then the Tabs becomes enabled so they can either click save or navigate to a different tab. In case they navigate to a different tab without clicking on save we will perform save for them. I think as a user perspective this is a good thing!

how to navigate on the button click

I am developing a SilverLight Project using SilverLight BusinessApplication Template RIA services.I want to navigate from one xaml page to another xaml page on the click of a Button that is placed on the first Xaml Page. i don't want to use Hyperlink button.
Any Suggestions...
Duplicate here:
Put this inside the event handler of the button:
this.NavigationService.Navigate(new Uri("nextpage.xaml", UriKind.Relative));

Resources