public void UpdateUi(ViewCell viewCell, object dataContext, HorizontalViewNative view) { var contentLayout = (FrameLayout)ItemView; viewCell.BindingContext = dataContext; viewCell.Parent = view; var metrics = Resources.System.DisplayMetrics; var height = (int)((view.ItemHeight + viewCell.View.Margin.Top + viewCell.View.Margin.Bottom) * metrics.Density); var width = (int)((view.ItemWidth + viewCell.View.Margin.Left + viewCell.View.Margin.Right) * metrics.Density); viewCell.View.Layout(new Rectangle(0, 0, view.ItemWidth, view.ItemHeight)); // Layout Android View var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) { Height = height, Width = width }; if (Platform.GetRenderer(viewCell.View) == null) { Platform.SetRenderer(viewCell.View, Platform.CreateRenderer(viewCell.View)); } var renderer = Platform.GetRenderer(viewCell.View); var viewGroup = renderer.View; viewGroup.LayoutParameters = layoutParams; viewGroup.Layout(0, 0, width, height); contentLayout.RemoveAllViews(); contentLayout.AddView(viewGroup); }
public void UpdateUi(ViewCell viewCell, object dataContext, HorizontalViewNative view) { viewCell.BindingContext = dataContext; viewCell.Parent = view; var height = (int)((view.ItemHeight + viewCell.View.Margin.Top + viewCell.View.Margin.Bottom)); var width = (int)((view.ItemWidth + viewCell.View.Margin.Left + viewCell.View.Margin.Right)); viewCell.View.Layout(new Rectangle(0, 0, width, height)); if (Platform.GetRenderer(viewCell.View) == null) { Platform.SetRenderer(viewCell.View, Platform.CreateRenderer(viewCell.View)); } var renderer = Platform.GetRenderer(viewCell.View).NativeView; foreach (UIView subView in ContentView.Subviews) { subView.RemoveFromSuperview(); } renderer.ContentMode = UIViewContentMode.ScaleAspectFit; ContentView.AddSubview(renderer); }
public RecycleViewAdapter(HorizontalViewNative view) { _view = view; _dataSource = view.ItemsSource?.Cast <object>()?.ToList(); HasStableIds = true; }
public iOSViewSource(HorizontalViewNative view) { _view = view; _dataSource = view.ItemsSource?.Cast <object>()?.ToList(); }