Ejemplo n.º 1
0
        public void addRotateButtons()
        {
            string packUri = "pack://application:,,,/Resources/rotateLeft.png";
            Image  img     = new Image();

            img.Source                     = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;
            leftButton                     = new SurfaceButton();
            leftButton.Content             = img;
            leftButton.Click              += new RoutedEventHandler(rotateLeft_Click);
            leftButton.Background          = System.Windows.Media.Brushes.Transparent;
            leftButton.BorderBrush         = System.Windows.Media.Brushes.Transparent;
            leftButton.Padding             = new Thickness(0);
            leftButton.Margin              = new Thickness(3, 0, 0, 0);
            leftButton.VerticalAlignment   = VerticalAlignment.Center;
            leftButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            leftButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            MainGrid.Children.Add(leftButton);
            leftButton.SetValue(Grid.ColumnProperty, 0);
            leftButton.SetValue(Grid.RowProperty, 1);

            string packUri2 = "pack://application:,,,/Resources/rotateRight.png";
            Image  img2     = new Image();

            img2.Source                     = new ImageSourceConverter().ConvertFromString(packUri2) as ImageSource;
            rightButton                     = new SurfaceButton();
            rightButton.Content             = img2;
            rightButton.Click              += new RoutedEventHandler(rotateRight_Click);
            rightButton.Background          = System.Windows.Media.Brushes.Transparent;
            rightButton.BorderBrush         = System.Windows.Media.Brushes.Transparent;
            rightButton.Padding             = new Thickness(0);
            rightButton.Margin              = new Thickness(0, 0, 3, 0);
            rightButton.VerticalAlignment   = VerticalAlignment.Center;
            rightButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            rightButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            MainGrid.Children.Add(rightButton);
            rightButton.SetValue(Grid.ColumnProperty, 2);
            rightButton.SetValue(Grid.RowProperty, 1);
        }
Ejemplo n.º 2
0
        private void SetSkin()
        {
            string packUri = "pack://application:,,,/Resources/iphoneBody.png";

            Control.MainBg.ImageSource = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource;

            // MAIN GRID DEFINITION
            RowDefinition r = new RowDefinition();

            r.Height = new GridLength(0.15, GridUnitType.Star);
            RowDefinition r1 = new RowDefinition();

            r1.Height = new GridLength(0.65, GridUnitType.Star);
            RowDefinition r2 = new RowDefinition();

            r2.Height = new GridLength(0.2, GridUnitType.Star);
            Control.MainGrid.RowDefinitions.Add(r);
            Control.MainGrid.RowDefinitions.Add(r1);
            Control.MainGrid.RowDefinitions.Add(r2);

            ColumnDefinition c = new ColumnDefinition();

            c.Width = new GridLength(0.07, GridUnitType.Star);
            ColumnDefinition c1 = new ColumnDefinition();

            c1.Width = new GridLength(0.86, GridUnitType.Star);
            ColumnDefinition c2 = new ColumnDefinition();

            c2.Width = new GridLength(0.07, GridUnitType.Star);
            Control.MainGrid.ColumnDefinitions.Add(c);
            Control.MainGrid.ColumnDefinitions.Add(c1);
            Control.MainGrid.ColumnDefinitions.Add(c2);

            Control.rdfWPF.SetValue(Grid.ColumnProperty, 1);
            Control.rdfWPF.SetValue(Grid.RowProperty, 1);

            Control.Footer.SetValue(Grid.ColumnProperty, 1);
            Control.Footer.SetValue(Grid.RowProperty, 2);

            // FOOTER GRID DEFINITION
            RowDefinition rf = new RowDefinition();

            rf.Height = new GridLength(0.2, GridUnitType.Star);
            RowDefinition rf1 = new RowDefinition();

            rf1.Height = new GridLength(0.5, GridUnitType.Star);
            RowDefinition rf2 = new RowDefinition();

            rf2.Height = new GridLength(0.3, GridUnitType.Star);
            Control.Footer.RowDefinitions.Add(rf);
            Control.Footer.RowDefinitions.Add(rf1);
            Control.Footer.RowDefinitions.Add(rf2);

            ColumnDefinition cf = new ColumnDefinition();

            cf.Width = new GridLength(0.38, GridUnitType.Star);
            ColumnDefinition cf1 = new ColumnDefinition();

            cf1.Width = new GridLength(0.24, GridUnitType.Star);
            ColumnDefinition cf2 = new ColumnDefinition();

            cf2.Width = new GridLength(0.38, GridUnitType.Star);
            Control.Footer.ColumnDefinitions.Add(cf);
            Control.Footer.ColumnDefinitions.Add(cf1);
            Control.Footer.ColumnDefinitions.Add(cf2);

            // HOME BUTTON
            SurfaceButton homeButton = new SurfaceButton();

            homeButton.Click              += new RoutedEventHandler(homeButton_Click);
            homeButton.Background          = System.Windows.Media.Brushes.Transparent;
            homeButton.BorderBrush         = System.Windows.Media.Brushes.Transparent;
            homeButton.VerticalAlignment   = VerticalAlignment.Stretch;
            homeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            homeButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            Control.Footer.Children.Add(homeButton);
            homeButton.SetValue(Grid.ColumnProperty, 1);
            homeButton.SetValue(Grid.RowProperty, 1);

            // HIDE BUTTON
            //SurfaceButton hideButton = new SurfaceButton();
            //hideButton.Click += new RoutedEventHandler(hideButton_Click);
            //hideButton.Background = System.Windows.Media.Brushes.Green;
            //hideButton.BorderBrush = System.Windows.Media.Brushes.Transparent;
            //hideButton.Opacity = 0.3;
            //hideButton.VerticalAlignment = VerticalAlignment.Stretch;
            //hideButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            //hideButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");
            //Control.Footer.Children.Add(hideButton);
            //hideButton.SetValue(Grid.ColumnProperty, 0);
            //hideButton.SetValue(Grid.RowProperty, 2);
            //hideButton.SetValue(Grid.ColumnSpanProperty, 3);

            // EXIT BUTTON
            //SurfaceButton closeButton = new SurfaceButton();
            //closeButton.Click += new RoutedEventHandler(Control.closeButton_Click);
            //closeButton.Background = System.Windows.Media.Brushes.Transparent;
            //closeButton.BorderBrush = System.Windows.Media.Brushes.Transparent;
            //closeButton.VerticalAlignment = VerticalAlignment.Top;
            //closeButton.HorizontalAlignment = HorizontalAlignment.Stretch;
            //closeButton.Padding = new Thickness(5);
            //closeButton.SetResourceReference(FrameworkElement.StyleProperty, "SurfaceButtonStyleInv");

            //var img = new System.Windows.Controls.Image();
            //string packUri1 = "pack://application:,,,/Resources/blackClose.png";
            //img.Source = new ImageSourceConverter().ConvertFromString(packUri1) as ImageSource;
            //closeButton.Content = img;

            //Control.MainGrid.Children.Add(closeButton);
            //closeButton.SetValue(Grid.ColumnProperty, 2);
            //closeButton.SetValue(Grid.RowProperty, 2);
        }