what is equivalent "frame" in C# application?
I must navigate from page to another page in windows application. I create master page and use some panel in page. I want to navigate from every panel to another page. how do i do?
you have to create a new window in a project and create an instance and then in a code when sb will click the nav element you need to create an instance of than window class and than invoke using method showWindow()
thank for your answer. but I get find my answer!:)
in master page , should use some panel and create user control.
you design whatever you want in user control, and in button_click in master page, get instance from user control and add to panel.
this codes are:
private void button_Click(object sender, EventArgs e)
usercontol1 user=new usercontrol1();
panel.controls.clear();
panel.controls.add(user);
Related
I have created a windows form hosted control. And I want to change focus on button click of Hosted Control to another application inside Unified Service Desk.
On Button Click event I am using below code,
private void button1_Click(object sender, EventArgs e)
{
FireRequestAction(new RequestActionEventArgs("CRM Global Manager",
"ShowTab", "test application"));
}
but for some reason it is not getting fired. If i perform any other operation inside this code block like for example displaying a messageBox it works fine. But unable to fire this action.
Never FireRequestAction. Instead, always FireEvent, and then define Event and Action Call records in the USD configuration (rather than in the Hosted Control code, as you have been attempting).
In this instance, call FireEvent and provide the event with a meaningful name. Next, write no further code. Proceed to the configuration. On your Hosted Control record, create a new Event record with an identical name. If applicable, relate it to your Configuration record. On this Event, add an Action Call to have the Global Manager do a ShowTab on your test application, and if applicable, relate this to your Configuration record as well.
I want to display a popup form when user clicks a button. But i don't want to create a new form and display it. Is there any tool in devex that could achieve this. Currently i am using Group Control to display instead of new popup form.
Please help me. Thanx in advance
You can use PopupControlContainer class and its PopupControlContainer.ShowPopup method:
private void simpleButton1_Click(object sender, EventArgs e)
{
popupControlContainer1.ShowPopup(Cursor.Position);
}
ps: Don't confuse between PopupControlContainer class and PopupContainerControl class.
You can use a popcontaineredit which looks like a dropdown. Make this so small that you can just see the Dropdown Button at the end. Modify the Button for your needs. Then use the PopupContainerControl. This is very similar to panel. You can easily customize it for your needs (add controls on it etc.). Then you have to connect popupedit and popcontrol. Click the edit and it will popup the popupcontrol. Let me know if you need further help.
I have two buttons in My View. One is Download Book and other is View Book. When i click on the View button I navigate to other page and Save the DataPager Current page. and on navigating back i have to show the Previously saved page in DataPager.
Is there any Method or property which i can use to Jump to Selected Page in DataPager Control in Silverlight 5.
I have get the Current Page number using the PageIndex but could not find a way to Navigate back to the same page. Every time The Page is starting From 1 and PageIndex 0.
Any help will be Appreciated. Thanx in advance.
Just make an event like
((BooksViewModel)LayoutRoot.DataContext).PropertyChanged += new PropertyChangedEventHandler(BooksView_PropertyChanged);
and call the
void BooksView_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "AnyDistinguishedstring")
{
Pager.PageIndex = 4; //it will take you to the page 5
}
}
and From Viewmodel call the
NotifyPropertyChanged("AnyDistinguishedstring");
will do the trick. :)
I'm using a PasswordBox on a Page. Because of the implemented workflow the user can navigate to sub pages (NavigationWindow) and than return with GoBack() to the main page.
But when doing that, the password box is always empty! My job is to prevent that behaviour, but at the moment I have no clue how do achive that.
It would be great if you could help me out.
Thanks
It is a feature.
See: How to bind to a PasswordBox in MVVM
To enable the backward navigation the state of the page needs to be stored. And that is not secure.
I don't think his exact problem is a feature, but a bug of the navigation service.
In your code behind you have no easy way to distinguish between the navigation control blanking your password on navigation or the user blanking it by deleting it from the box.
So if you don't consider that, your password in your viewmodel will always be blank if you navigate to another page.
I used this hack to determine who called my password changed handler to update the view model:
private void PasswordBox_OnPasswordChanged(object sender, RoutedEventArgs e)
{
StackTrace stack = new StackTrace();
StackFrame[] stackframes = stack.GetFrames();
foreach (StackFrame stackFrame in stackframes)
if(stackFrame.GetMethod().Name == "Navigate")
return;
ViewModelPassword = PasswordBox.SecurePassword;
....
Take a look here too: http://www.wpfsharp.com/2011/04/08/wpf-navigationservice-blanks-passwordbox-password-which-breaks-the-mvvm-passwordhelper/
I have a Win form application (VS 2010 / C#) and I'm trying to figure out how to refresh pages without a refresh button. Currently I can refresh a page (basically to reset the data bindings) with a refresh button containing code something like this (this.refresh() does not seem to work for some reason):
this.Hide();
AccountSettings AS = new AccountSettings();
AS.ShowDialog();
An example I have is a page with numerous settings including data grids with CellClick events. When I click a cell I can make changes to a database. I hit close to go back to the Settings page but the only way for me to see the changes are to refresh() the page via the button.
So the short of it is, is there any way to refresh a form page from another form page?
For instance, when I click the Save button or close the child window.
Maybe pass the original form as an argument to the second form:
Form2 frm2 = new Form2(this);
And in Form2:
Form1 frm1;
public Form2(Form1 frm1)
{
InitializeComponent();
this.frm1 = frm1;
}
And then have in Form2:
frm1.Update();
Refresh on winform controls repaints the control itself. I find it useful to create a method that just loads my controls with the proper data, and then call it as necessary. (Including Form load)
private void ResetData()
{
//code to update settings
}
If you are showing the form that is closing as a dialog also you can take advantage of that, and check the status of the dialog instead of just opening it.
Form2 dlg = new Form2();
if (dlg.ShowDialog == System.Windows.Forms.DialogResult.OK) {
//code that updates your data
ResetData();
}
If its not a dialog there are a few things you could do and how your application works would make one method better than others. Here is just one example.
If your changes are something you don't need access to data from the other window to update you can handle the closed event of the form you create.
Create a class level variable to hold the form that is opened, so that you can also remove the event handlers you create:
private Form2 frm;
To create an instance of the form, and add the close event handler:
frm = new Form2();
frm.FormClosed += OnForm2Closed;
The event handler method:
private void OnForm2Closed(object sender, FormClosedEventArgs e)
{
ResetData();
frm.FormClosed -= OnForm2Closed;
}