Skip to content

Commit 339379f

Browse files
committedAug 14, 2015
WpfHostingWindowsFormsControl:
Make sample work by hooking up the Init function. Not sure how this ever worked before.
1 parent d9fd7ff commit 339379f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
 

Diff for: ‎Migration and Interoperability/WpfHostingWindowsFormsControl/WPFApp/MainWindow.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@ public partial class MainWindow : Window
2121
private FontStyle _initFontStyle;
2222
private FontWeight _initFontWeight;
2323
private SolidColorBrush _initForeBrush;
24-
private NavigationWindow _myWindow;
24+
private MainWindow _myWindow;
2525
private bool _uiIsReady;
2626

27+
public MainWindow() {
28+
Loaded += MainWindow_Loaded;
29+
}
30+
31+
private void MainWindow_Loaded(object sender, RoutedEventArgs e) {
32+
Init(sender, e);
33+
}
34+
2735
private void Init(object sender, EventArgs e)
2836
{
2937
_app = Application.Current;
30-
_myWindow = (NavigationWindow) _app.MainWindow;
38+
_myWindow = (MainWindow)_app.MainWindow;
3139
_myWindow.SizeToContent = SizeToContent.WidthAndHeight;
3240
wfh.TabIndex = 10;
3341
_initFontSize = wfh.FontSize;

Diff for: ‎Migration and Interoperability/WpfHostingWindowsFormsControl/WPFApp/MainWindow.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:local="clr-namespace:WPFApp"
77
xmlns:mcl="clr-namespace:MyControls;assembly=FormsControlLibrary"
88
mc:Ignorable="d"
9-
Title="MainWindow" Height="350" Width="525">
9+
Title="MainWindow" Height="560" Width="560">
1010
<DockPanel>
1111
<DockPanel.Resources>
1212
<Style x:Key="InlineText" TargetType="{x:Type Inline}">
@@ -22,7 +22,7 @@
2222
<StackPanel Orientation="Vertical"
2323
DockPanel.Dock="Left"
2424
Background="Bisque"
25-
Width="250">
25+
Width="170">
2626

2727
<TextBlock Margin="10,10,10,10"
2828
FontWeight="Bold"

0 commit comments

Comments
 (0)