Exemplo n.º 1
0
        private bool TryComputeAreaSizeComponents(SheetSnapAreaCollection areas, out double totalStarSize, out double starDenominator)
        {
            if (areas.Empty())
            {
                totalStarSize = starDenominator = 0;
                return(false);
            }
            else
            {
                var totalSize = ActualHeight;

                // This is the space occupied by all absolute-sized areas.
                var totalAbsoluteSize = areas
                                        .Where(a => a.Height.IsAbsolute)
                                        .Sum(a => a.Height.Value);

                // This is the space occupied by all star-sized areas.
                totalStarSize = totalSize - totalAbsoluteSize;

                // this is used to calculate the height of star-sized areas.
                starDenominator = areas
                                  .Where(a => a.Height.IsStar)
                                  .Sum(a => a.Height.Value);

                return(true);
            }
        }
Exemplo n.º 2
0
        public ModalStandardBottomSheet()
        {
            DefaultStyleKey = typeof(ModalStandardBottomSheet);

            SnapAreas = new SheetSnapAreaCollection()
            {
                _defaultTopSnapPoint,
                _defaultCenterSnapPoint,
                _defaultBottomSnapPoint
            };

            InitialSnapAreaName = _defaultBottomSnapPoint.Name;

            (this as DependencyObject).RegisterPropertyChangedCallback(ModalStandardBottomSheet.CurrentSnapAreaProperty, (s, e) => OnCurrentSnapAreaChanged(s, e));
            (this as DependencyObject).RegisterPropertyChangedCallback(ModalStandardBottomSheet.SheetPositionProperty, (s, e) => OnPositionChanged(s, e));
#if __IOS__
            // Workaround for #405 - iOS ActualHeight of inner elemens not known on creation
            SizeChanged += OnSizeChanged;
#endif
        }