TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dinesh Kudale
1.6k
127
17.6k
Is it possible to add another Windows form inside MainWindow form ?
May 19 2021 9:05 AM
In MainWindow.xaml:
<avalonDock:LayoutDocument x:Name=
"docBlock1"
ContentId=
"contentBlock1"
Title=
"Block 1"
>
<StackPanel x:Name=
"spBlock1"
Loaded=
"spBlock1_Loaded"
/>
</avalonDock:LayoutDocument>
It is a 'Block1' tab window Inside MainWindow. I have implemented AvalonDock inside MainWindow for docking purposes.
In MainWindow.xaml.cs
private
void
spBlock1_Loaded(
object
sender, RoutedEventArgs e)
{
WindowInteropHelper windowHwnd =
new
WindowInteropHelper(
this
);
}
WindowInteropHelper() method is from the Windows C# project. We have DLL of this Windows C# project. We don't have any source code for this project. My application is in WPF C#. I am calling WindowInteropHelper() inside my WPF project's event. The purpose of this method is to add one user control to the form.
But this WindowInteropHelper() takes only one parameter and it must be the 'Window' parameter. Please, see below-attached image.
But I want to use the same control inside my 'Block 1' tab. But in this WindowInteropHelper() method call, I have passed 'this' keyword. 'this' is pointing to MainWindow. Hence control will see outside of the 'Block 1' tab. Is it possible to show this control inside the 'Block 1' tab? How can I achieve it? Is it possible to add another 'Window' form inside that 'Block 1'? Then I will pass this added new form in place of 'this' keyword to achieve my task.
Thanks in advance.
Reply
Answers (
2
)
Is really usercontrol can't be style in WPF ?
Uniformgrid panel visible always