Button _negative;
string _title;
string _subtitle;
+ StackLayout _contentView;
bool _isDisposed = false;
- bool _isNullable = false;
ElmSharp.Button _nativePositive;
+
ElmSharp.Button _nativeNeutral;
ElmSharp.Button _nativeNegative;
ElmSharp.EvasObject _nativeContent;
_control.KeyUp += BackButtonPressedHandler;
PropertyChanged += PropertyChangedHandler;
+
+ _contentView = new StackLayout();
}
~DialogImplementation()
public void Dismiss()
{
- _control.Dismiss();
+ _control.Hide();
}
public void Dispose()
void ShowAnimationFinishedHandler(object sender, EventArgs e)
{
+ _nativeContent.MarkChanged();
Shown?.Invoke(this, EventArgs.Empty);
GrabBackkey();
}
{
Dismissed?.Invoke(this, EventArgs.Empty);
UngrabBackKey();
- //Native control should be freed after dismissed event occurred. (this is EFL's law.)
- Dispose();
}
void OutsideClickedHandler(object sender, EventArgs e)
void UpdateContent()
{
- _isNullable = _nativeContent != null ? true : false;
-
- _nativeContent?.Hide();
-
- View contentView = null;
+ _contentView.Children.Clear();
- if (Content.GetType() == typeof(ScrollView))
- {
- contentView = new StackLayout
- {
- Children =
- {
- Content
- }
- };
- }
- else
+ if (Content != null)
{
- contentView = Content;
- }
+ _contentView.Children.Add(Content);
- if (contentView != null)
- {
- contentView.Parent = Application.Current.MainPage;
- _nativeContent = Platform.GetOrCreateRenderer(contentView).NativeView;
+ _contentView.Platform = Application.Current.MainPage.Platform;
- var sizeRequest = contentView.Measure(TForms.Context.MainWindow.ScreenSize.Width, TForms.Context.MainWindow.ScreenSize.Height).Request.ToPixel();
+ var renderer = Platform.GetOrCreateRenderer(_contentView);
+ (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated();
+ var sizeRequest = _contentView.Measure(TForms.Context.MainWindow.ScreenSize.Width, TForms.Context.MainWindow.ScreenSize.Height).Request.ToPixel();
+
+ _nativeContent = renderer.NativeView;
_nativeContent.MinimumHeight = sizeRequest.Height;
+
+ _control.SetPartContent("default", _nativeContent, true);
}
else
{
- _nativeContent = null;
+ _control.SetPartContent("default", null, true);
}
-
- _control.SetPartContent("default", _nativeContent, _isNullable);
}
void UpdatePositive()
{
- _isNullable = _nativePositive != null ? true : false;
-
_nativePositive?.Hide();
if (Positive != null)
_nativePositive = null;
}
- _control.SetPartContent("button1", _nativePositive, _isNullable);
+ _control.SetPartContent("button1", _nativePositive, true);
}
void UpdateNeutral()
{
- _isNullable = _nativeNeutral != null ? true : false;
-
_nativeNeutral?.Hide();
if (Neutral != null)
_nativeNeutral = null;
}
- _control.SetPartContent("button2", _nativeNeutral, _isNullable);
+ _control.SetPartContent("button2", _nativeNeutral, true);
}
void UpdateNegative()
{
- _isNullable = _nativeNegative != null ? true : false;
-
_nativeNegative?.Hide();
if (Negative != null)
_nativeNegative = null;
}
- _control.SetPartContent("button3", _nativeNegative, _isNullable);
+ _control.SetPartContent("button3", _nativeNegative, true);
}
void UpdateTitle()