I have developed a WPF ERP in which i have a single main window and rest windows i have created as UserControls...
Currently I am displaying the user controls in a ContentFrame in the MainWindow but my problem is that i can only display a single user control in a WPF Content Frame and i cant create a Content Frame dynamically...
How can i overcome this...
I have opened the child window as
Stock s=new Stock(); //UserControll
mainGrid.Children.Add(s);
Related
I am showing a WPF exe window inside another WPF application using winform host.
I have created a panel in main application and set it as child of winformhost.
mHostingPanel = new System.Windows.Forms.Panel()
{
BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
};
mWinformHost = new WindowsFormsHost();
mWinformHost.Child = mHostingPanel;
and then I start the other window process and set hosting panel as parent.
WindowsAPI.SetParent(mProcess.MainWindowHandle, mHostingPanel.Handle);
My question is if I launch the application,Who will be rendering my Child WPF window whose parent is a winform panel.Will it be Direct-X or GDI context of Panel?
Also if I set Allowtransparency=True on child WPF application,The UI doesnt show up in hosting panel.
Found the reason.Its called airspace issue (when win32 and WPF trying to share pixels) and I dont think it can be solved by any framework API as microsoft denied it.
https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2644120-bring-back-the-hwndhost-isredirected-and-compositi
Mitigating AirSpace issues
I am developing a WPF application where i have a MainWindow that has a Frame control and a Label Control inside it, i have set the source of the Frame control to one of the pages i have created, what i want is to be able to change the content of Label control (inside Main window) from my Page.xaml which is displayed inside the Frame control.
Here is an Image to further illustrate what i really want . excuse my drawing!!
Page page = new Page(this);
Framme.Content = page;
Firstly, I have a project with a Windows Form that references another project with WPF forms. The windows form has an elementhost which child is one of the WPF documents in the other project.
Now, on this WPF document I want to have a button that upon a click can open another wpf form. Either as a new standalone WPF form, as a modal or whatever.
I cannot, on the button click event, say
WPFform2 WPFform2=new WPFform2();<br>
WPFform2.Show();
... as many other threads on the net suggest, since the show method does not exist.
My solution does not allow some sort of call that changes the main FormĀ“s elementhost, so that is not an option for me.
All my WPF forms derives from UserControl:
public partial class WPFform1: UserControl
The form must be derived from Window to have the Show() method.
Just create a new window that contains only the form you want to show and call Show on it. Or change the control's base class to Window (you will have to rewrite it both in XAML and in the code behind), nothing should really change, Window supports most of UserControl's features.
lets say i have a main form which have a lot of functionallity.
this form have a tab control in which each tab contain some set of functionality.
what i want to do is when i click on each tab controls button i want to load a form into the client area of the tab control.
so instead of having a lot of controls in the main form , i will only have set of forms and each form will have its control.
i think this is will be better in term of managing the controls so i dont have like 150 control on the main form.
so basically i want to load a form on another form and not show the form in a seperate view.
if its not possible with forms then can i use another control that will group the controls and will be loaded on the main form?
thanks
Alternate 1 :
You can make each of the form as a User Control and then you can load the appropriate user control in a blank panel in your main form whenever required.
You should be able to find a way to communicate between your form and those user controls.
Alternate 2 :
You can show the appropriate Form using ShowModal() method, with the main form as parent, that way user can finish the work with the child form, before coming back to the main form.
Disadvantages here are user wont be able to interact with the main form as long as the child form is closed.
I would recommend looking into User Controls.
User Controls come with a designer, just like forms, and have a rich event model to tap into. Unlike forms, they are easy to embed into other controls and forms. As a matter of fact, user controls will show up in your toolbox to drag-and-drop onto another form.
It's at least worth taking a look at.
Following code adds one Form to a panel in another form.
Add this code in Form1
Form2 ff = new Form2();
ff.TopLevel = false;
ff.Dock = DockStyle.Fill;
ff.ControlBox = false;
ff.Text = "";
panel1.Controls.Add(ff);
ff.Show();
The flip side is your panel should be big enough to accomodate the form...
Currently have an UltraToolBar displaying within a MDI child window currently all the buttons on the bar function but they do not show their tooltips when hovered over. I was wondering if anyone else may have dealt with this problem before and what they did.
Are you using the toolbar in Ribbon mode or in old toolbar mode?
If the toolbar is in on a child mdi form, you should probably be merging it into the parent mdi manager.
On your 'main form' you should use a UltraTabbedMdiManager class to open your child MDI windows. Get the main structure of you app set up right and the small stuff with fall out naturally.