blob: aa811510d7593ae9e97146fbd9ace1d1f07d4407 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
using System.Collections.Generic;
namespace Xamarin.Forms
{
public class TemplatedPage : Page, IControlTemplated
{
public static readonly BindableProperty ControlTemplateProperty = BindableProperty.Create(nameof(ControlTemplate), typeof(ControlTemplate), typeof(TemplatedPage), null,
propertyChanged: TemplateUtilities.OnControlTemplateChanged);
public ControlTemplate ControlTemplate
{
get { return (ControlTemplate)GetValue(ControlTemplateProperty); }
set { SetValue(ControlTemplateProperty, value); }
}
IList<Element> IControlTemplated.InternalChildren => ((IPageController)this).InternalChildren;
internal override void ComputeConstraintForView(View view)
{
LayoutOptions vOptions = view.VerticalOptions;
LayoutOptions hOptions = view.HorizontalOptions;
var result = LayoutConstraint.None;
if (vOptions.Alignment == LayoutAlignment.Fill)
result |= LayoutConstraint.VerticallyFixed;
if (hOptions.Alignment == LayoutAlignment.Fill)
result |= LayoutConstraint.HorizontallyFixed;
view.ComputedConstraint = result;
}
internal override void SetChildInheritedBindingContext(Element child, object context)
{
if (ControlTemplate == null)
base.SetChildInheritedBindingContext(child, context);
}
}
}
|