public List(TemplateInflator controlTemplateInflator, Func <ICollection <ControlTemplate> > getControlTemplates, IPropertyEngine propertyEngine) : base(propertyEngine) { RegistrationGuard.RegisterFor <List>(() => { ItemTemplateProperty = ItemTemplateProperty = PropertyEngine.RegisterProperty("ItemTemplate", typeof(List), typeof(DataTemplate), new PropertyMetadata()); SourceProperty = SourceProperty = PropertyEngine.RegisterProperty("Source", typeof(List), typeof(IObservableCollection <object>), new PropertyMetadata()); }); this.controlTemplateInflator = controlTemplateInflator; this.getControlTemplates = getControlTemplates; panel = new StackPanel(propertyEngine); this.AddChild(panel); subscription = GetChangedObservable(SourceProperty).Subscribe(obj => { var source = (ISourceList <object>)obj; Platform.Current.EventSource.Invalidate(); source.Connect() .OnItemAdded(AddItem) .ForEachChange(_ => Platform.Current.EventSource.Invalidate()) .Subscribe(); }); }
public ContentLayout(IPropertyEngine propertyEngine) : base(propertyEngine) { RegistrationGuard.RegisterFor <ContentLayout>(() => { ContentProperty = PropertyEngine.RegisterProperty("Content", typeof(ContentLayout), typeof(object), new PropertyMetadata { DefaultValue = null }); }); GetChangedObservable(ContentProperty).Subscribe(SetContent); }
protected Layout(IPropertyEngine propertyEngine) { PropertyEngine = propertyEngine; RegistrationGuard.RegisterFor <Layout>(() => { DataContextProperty = DataContextProperty = PropertyEngine.RegisterProperty("DataContext", typeof(Layout), typeof(object), new PropertyMetadata()); }); Children = new OwnedList <Layout>(this); Children.OnChildAdded(layout => { layout.DataContext = DataContext; GetChangedObservable(DataContextProperty).Subscribe(o => layout.DataContext = o); }); Pointer = new PointerEvents(this, Platform.Current.EventSource); Keyboard = new KeyboardEvents(this, Platform.Current.EventSource, Platform.Current.FocusedElement); }
public Grid(IPropertyEngine propertyEngine) : base(propertyEngine) { RegistrationGuard.RegisterFor <Grid>(() => { RowSpanProperty = PropertyEngine.RegisterProperty("RowSpan", typeof(Grid), typeof(int), new AttachedPropertyMetadata { DefaultValue = 1 }); ColumnSpanProperty = PropertyEngine.RegisterProperty("ColumnSpan", typeof(Grid), typeof(int), new AttachedPropertyMetadata { DefaultValue = 1 }); RowProperty = PropertyEngine.RegisterProperty("Row", typeof(Grid), typeof(int), new AttachedPropertyMetadata { DefaultValue = 0 }); ColumnProperty = PropertyEngine.RegisterProperty("Column", typeof(Grid), typeof(int), new AttachedPropertyMetadata { DefaultValue = 0 }); }); }