Пример #1
0
        public MainPage()
        {
            InitializeComponent();

            var mainCollection = (ConstraintCollection)Resources["Constraints"];
            var altCollection  = (ConstraintCollection)Resources["AltConstraints"];

            mainCollection.Add(PositionConstraint.CenterX(Toggle).ToCenterX(Layout));
            mainCollection.Add(PositionConstraint.CenterY(Toggle).ToCenterY(Layout));
            mainCollection.Add(DimensionConstraint.Width(Toggle, -20).ToWidth(Layout, 0.5f));
            mainCollection.Add(DimensionConstraint.Height(Toggle, -20).ToHeight(Layout, 0.3f));

            altCollection.Add(PositionConstraint.Left(Toggle).ToLeft(LeftLabel));
            altCollection.Add(DimensionConstraint.Width(Toggle, 400));
            altCollection.Add(PositionConstraint.Top(Toggle).ToBottom(BottomLabel));
            altCollection.Add(PositionConstraint.Bottom(Toggle).ToBottom(Layout));
        }