Skip to content

Commit ddc2396

Browse files
https://github.com/AndreiMisiukevich/HotReload/issues/132
1 parent bfd8fe2 commit ddc2396

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

Reloader/Xamarin.Forms.HotReload.Reloader/HotReloader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ private void ReloadElement(object obj, ReloadItem reloadItem, Type csharpType =
678678
layout.Children.Remove(view);
679679
break;
680680
case ContentPage page:
681-
page.Content = view;
681+
page.Content = newView;
682682
break;
683683
}
684684
break;

Sample/Xamarin.Forms.HotReload.Sample/Pages/CodePage.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
using System;
22

33
using Xamarin.Forms;
4+
using Xamarin.Forms.HotReload.Sample.Pages.Views;
45

56
namespace Xamarin.Forms.HotReload.Sample.Pages
67
{
78
public class CodePage : ContentPage
89
{
910
public CodePage()
1011
{
12+
BackgroundColor = Color.Red;
1113
Content = new StackLayout
1214
{
13-
Children = {
14-
new Label {
15-
VerticalOptions = LayoutOptions.CenterAndExpand,
16-
HorizontalOptions = LayoutOptions.CenterAndExpand,
17-
Text = "Hello ContentPage!!!!"
18-
}
15+
Children =
16+
{
17+
new CustomContentView(),
18+
new Button { Text = "Click", BackgroundColor = Color.White }
1919
}
2020
};
2121
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
3+
using Xamarin.Forms;
4+
5+
namespace Xamarin.Forms.HotReload.Sample.Pages.Views
6+
{
7+
public class CustomContentView : ContentView
8+
{
9+
public CustomContentView()
10+
{
11+
Margin = new Thickness(50);
12+
BackgroundColor = Color.Yellow;
13+
VerticalOptions = LayoutOptions.FillAndExpand;
14+
HorizontalOptions = LayoutOptions.FillAndExpand;
15+
16+
Content = new Label
17+
{
18+
Text = "HI Xamarin!",
19+
VerticalOptions = LayoutOptions.CenterAndExpand
20+
};
21+
}
22+
}
23+
}
24+

0 commit comments

Comments
 (0)