Inheritance: FrameworkElement, IBorder
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                argument = (int)e.Parameter;
            }
            catch (Exception e1) { }

            string savedBackgroundImageName = App.backgroundImage;

            if (savedBackgroundImageName != null)
            {
                savedBackgroundImageName = savedBackgroundImageName.Split('.')[0];
                if (savedBackgroundImageName != "")
                {
                    Image savedBackgroundImageInstance = (Image)FindName(savedBackgroundImageName);
                    savedBackgroundImageInstance.Opacity = 0.6;
                    newSelectedImage = savedBackgroundImageInstance;

                    Border bb = (Border)FindName("bb" + savedBackgroundImageName);
                    bb.BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Gray);
                    previouslySelect = bb;
                    //BottomAppBar.IsOpen = true;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 사용 X
        /// </summary>
        public static void FlyAlert()
        {
            Flyout f = new Flyout();

            Border b = new Border();
            b.Width = 300;
            b.Height = 125;

            TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            tb.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            tb.TextWrapping = TextWrapping.Wrap;
            tb.FontSize = 24.667;
            tb.Text = "This is a basic ContentControl so put anything you want in here.";

            b.Child = tb;

            f.Content = b;

            f.Placement = (PlacementMode)Enum.Parse(typeof(PlacementMode), "Top");
            //f.PlacementTarget = sender as UIElement;

            f.IsOpen = true;

            ObjectTracker.Track(f);
        }
        /// <summary>
        /// Invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate.
        /// In simplest terms, this means the method is called just before a UI element displays in your app.
        /// Override this method to influence the default post-template logic of a class.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            // Border
            this.border = this.GetTemplateChild(BorderPartName) as Border;
            if (this.border != null)
            {
                this.border.ManipulationStarted += Border_ManipulationStarted;
                this.border.ManipulationDelta += Border_ManipulationDelta;
                this.border.ManipulationCompleted += Border_ManipulationCompleted;
                this.border.Tapped += Border_Tapped;
                this.border.PointerEntered += Border_PointerEntered;

                // Move Canvas properties from control to border.
                Canvas.SetLeft(this.border, Canvas.GetLeft(this));
                Canvas.SetLeft(this, 0);
                Canvas.SetTop(this.border, Canvas.GetTop(this));
                Canvas.SetTop(this, 0);

                // Move Margin to border.
                this.border.Padding = this.Margin;
                this.Margin = new Thickness(0);
            }
            else
            {
                // Exception
                throw new Exception("Floating Control Style has no Border.");
            }

            // Overlay
            this.overlay = GetTemplateChild(OverlayPartName) as UIElement;

            this.Loaded += Floating_Loaded;
        }
        public virtual void Add(UIElement control)
        {
            int rows = _grid.RowDefinitions.Count;
            _grid.RowDefinitions.Add(new RowDefinition());

            var textBlock = new TextBlock
            {
                Text = ListItemPrefix,
                Margin = new Thickness(0, 5, 0, 5),
                HorizontalAlignment = HorizontalAlignment.Center
            };
            Grid.SetColumn(textBlock, 0);
            Grid.SetRow(textBlock, rows);
            _grid.Children.Add(textBlock);

            if ((control is FrameworkElement) == false)
            {
                // UIElement can set column and row,
                // so use a border.
                var border = new Border
                {
                    Child = control
                };
                control = border;
            }
            Grid.SetColumn((FrameworkElement)control, 1);
            Grid.SetRow((FrameworkElement)control, rows);
            _grid.Children.Add(control);
        }
        void init()
        {
            Background = new SolidColorBrush(Colors.Transparent);
            VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
            HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
            _transform = new CompositeTransform();
            _c_transform = new CompositeTransform();
            RenderTransform = _transform;

            //scroll
            _scroll = new ScrollViewer()
            {
                HorizontalScrollMode = ScrollMode.Enabled,
                VerticalScrollMode = ScrollMode.Enabled,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden,
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden
            };
            Children.Add(_scroll);
            //content
            _content = new Grid() { HorizontalAlignment = HorizontalAlignment.Left, ManipulationMode = ManipulationModes.All };
            _content.RenderTransform = _c_transform;
            _image = new Image() { Stretch = Stretch.UniformToFill };
            _border = new Border() { CornerRadius = new Windows.UI.Xaml.CornerRadius(10) };
            _content.Children.Add(_image);
            _content.Children.Add(_border);
            _scroll.Content = _content;
        }
        public GroupBoxContainer(Span span)
        {
            var grid = new Grid();
            grid.RowDefinitions.Add(new RowDefinition
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition());

            _titleBlock = new TextBlock();
            grid.Children.Add(_titleBlock);

            var border = new Border
            {
                BorderBrush = new SolidColorBrush(Colors.Gray),
                BorderThickness = new Thickness(1, 0, 0, 1),
                Margin = new Thickness(5, 0, 0, 5),
                Padding = new Thickness(3, 0, 0, 3)
            };
            Grid.SetRow(border, 1);
            grid.Children.Add(border);

            var richTextBlock = new RichTextBlock()
            {
                IsTextSelectionEnabled = false
            };
            border.Child = richTextBlock;
            _innerContainer = new RichTextBlockContainer(richTextBlock);

            span.Inlines.Add(new InlineUIContainer()
            {
                Child = grid
            });
        }
Exemple #7
0
        private static void OnPathChanged( DependencyObject obj, DependencyPropertyChangedEventArgs args )
        {
            var icon = (Icon) obj;
            var data = (string) args.NewValue;

            if ( data == null )
            {
                return;
            }

            // Copy it since sharing it isn't permitted
            var path = (Path) XamlReader.Load( "<Path xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Data=\"" + data + "\" />" );

            path.Stretch = Stretch.Uniform;
            path.HorizontalAlignment = HorizontalAlignment.Center;
            path.VerticalAlignment = VerticalAlignment.Center;
            path.SetBinding( Path.FillProperty, new Binding { Source = icon, Path = new PropertyPath( "Foreground" ) } );
            path.SetBinding( Path.MarginProperty, new Binding { Source = icon, Path = new PropertyPath( "Padding" ) } );

            var container = new Border
            {
                Child = path
            };
            container.SetBinding( Border.WidthProperty, new Binding { Source = icon, Path = new PropertyPath( "IconWidth" ) } );
            container.SetBinding( Border.HeightProperty, new Binding { Source = icon, Path = new PropertyPath( "IconHeight" ) } );
            container.SetBinding( Border.BackgroundProperty, new Binding { Source = icon, Path = new PropertyPath( "Background" ) } );

            icon.HorizontalAlignment = HorizontalAlignment.Center;
            icon.VerticalAlignment = VerticalAlignment.Center;
            icon.Content = new Viewbox
            {
                Child = container
            };
        }
        private void AddItemButton_Click(object sender, RoutedEventArgs e)
        {
            if (RepositionItemsContainer.Items != null && RepositionItemsContainer.Items.Count > 0)
            {
                int itemPosition = rand.Next(0, RepositionItemsContainer.Items.Count);

                int randomImage = rand.Next(0, 17);

                var item = new Image
                {
                    Source = new BitmapImage
                    {
                        UriSource = new Uri("ms-appx:///Images/LandscapeImage" + randomImage.ToString() + ".jpg", UriKind.Absolute)
                    },
                    Width = 200,
                    Height = 134
                };

                var border = new Border
                {
                    BorderBrush = new SolidColorBrush(Color.FromArgb(112, 255, 255, 255)),
                    BorderThickness = new Thickness(1),
                    Margin = new Thickness(4),
                    Child = item
                };

                RepositionItemsContainer.Items.Insert(itemPosition, border);
            }
        }
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // make sure we listen at the right time to add/remove the back button event handlers
            if(_backButton != null)
            {
                _backButton.Tapped -= OnBackButtonTapped;
            }
            _backButton = GetTemplateChild("SettingsBackButton") as Button;
            if(_backButton != null)
            {
                _backButton.Tapped += OnBackButtonTapped;
            }

            // need to get these grids in order to set the offsets correctly in RTL situations
            if (_contentGrid == null)
            {
                _contentGrid = GetTemplateChild("SettingsFlyoutContentGrid") as Grid;
            }
            _contentGrid.Transitions = new TransitionCollection();
            _contentGrid.Transitions.Add(new EntranceThemeTransition()
            {
                FromHorizontalOffset = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? CONTENT_HORIZONTAL_OFFSET : (CONTENT_HORIZONTAL_OFFSET * -1)
            });

            // need the root border for RTL scenarios
            _rootBorder = GetTemplateChild("PART_RootBorder") as Border;

            // need the content scrollviewer to set the fixed width to be the same size as flyout
            _contentScrollViewer = GetTemplateChild("PART_ContentScrollViewer") as ScrollViewer;
            
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            /// <summary>
            /// Invoked when this page is about to be displayed in a Frame.
            /// </summary>
            /// <param name="e">Event data that describes how this page was reached.  The Parameter
            /// property is typically used to configure the page.</param>
            /// 

            try
            {
                argument = (int)e.Parameter;
            }
            catch (Exception e1)
            { }

            string savedBackgroundImageName = App.backgroundImage;

            if (savedBackgroundImageName != null)
            {
                savedBackgroundImageName = savedBackgroundImageName.Split('.')[0];
                if (savedBackgroundImageName != "")
                {
                    Image savedBackgroundImageInstance = (Image)FindName(savedBackgroundImageName);
                    savedBackgroundImageInstance.Opacity = 0.6;
                    newSelectedImage = savedBackgroundImageInstance;

                    Border bb = (Border)FindName("bb" + savedBackgroundImageName);
                    bb.BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Gray);
                    previouslySelect = bb;
                    //BottomAppBar.IsOpen = true;
                }
            }
        }
Exemple #11
0
 public BubbleContent(Bubble parent, string text = "")
 {
     this.parent = parent;
     double radius = parent.getRadius();
     textblock = new TextBlock()
     {
         Text = text,
         Foreground = new SolidColorBrush(ColorSettings.TextColor),
         TextAlignment = Windows.UI.Xaml.TextAlignment.Center,
         FontSize = Preferences.FontSize,
         FontFamily = Preferences.FontFamily,
         Width = radius * 2,
         MaxHeight = radius * 2,
         TextWrapping = TextWrapping.WrapWholeWords,
         TextTrimming = TextTrimming.CharacterEllipsis,
         VerticalAlignment = VerticalAlignment.Center,
     };
     textcontainer = new Border()
     {
         Height = radius * 2,
         Child = textblock,
     };
     BubbleContainer.canvas.Children.Add(textcontainer);
     Canvas.SetZIndex(textcontainer, Int16.MaxValue);
 }
Exemple #12
0
        private static async Task GenerateTileImagesAsyncInternal(Border mediumTileHost, Border wideTileHost, TileSettings settings)
        {
            var tileModel = await TileModelBuilder.BuildTileModelAsync(settings);

            await TileImageGenerator.GenerateMediumTileImageFileAsync(tileModel, mediumTileHost);
            await TileImageGenerator.GenerateWideTileImageFileAsync(tileModel, wideTileHost);
        }
        // Unused and untested 
        public static void ShowMessage(string message, UIElement placementTarget, PlacementMode placementMode=PlacementMode.Top)
        {
            var f = new Callisto.Controls.Flyout();

            var b = new Border()
                           {
                               Width = 300,
                               Height = 125
                           };

            TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = HorizontalAlignment.Center;
            tb.VerticalAlignment = VerticalAlignment.Center;
            tb.TextWrapping = TextWrapping.Wrap;
            tb.FontSize = 12f;
            tb.Text = message;

            b.Child = tb;

            f.Content = b;

            f.Placement = placementMode;
            f.PlacementTarget = placementTarget;

            f.IsOpen = true;
        }
        private void showPopup_Click(object sender, RoutedEventArgs e)
        {
            // Create some content to show in the popup. Typically you would // create a user control.
            Border border = new Border();
            border.BorderThickness = new Thickness(5.0);

            StackPanel panel1 = new StackPanel();

            Button button1 = new Button();
            button1.Content = "Close";
            button1.Margin = new Thickness(5.0);
            button1.Click += new RoutedEventHandler(button1_Click);
            TextBlock textblock1 = new TextBlock();
            textblock1.Text = "The popup control";
            textblock1.Margin = new Thickness(5.0);
            panel1.Children.Add(textblock1);
            panel1.Children.Add(button1);
            border.Child = panel1;

            MoviePlayer MovieFrame = new MoviePlayer(ref p);

            // Set the Child property of Popup to the border // which contains a stackpanel, textblock and button.
            p.Child = MovieFrame;

            // Set where the popup will show up on the screen.
            p.VerticalOffset = 110;
            p.HorizontalOffset = 0;

            // Open the popup.
            p.IsLightDismissEnabled = true;
            p.IsOpen = true;
        }
        private void Create_Cells()
        {
            _borders = new List<Border>();
            _values = new List<TextBlock>();

            for (int row = 0; row < 9; row++)
            {
                for (int col = 0; col < 9; col++)
                {

                    var cell = new TextBlock();
                    Grid.SetRow(cell, row);
                    Grid.SetColumn(cell, col);

                    var border = new Border { BorderBrush = new SolidColorBrush(Colors.White), BorderThickness = new Thickness(1), Background = new SolidColorBrush(Colors.Black) };

                    border.Tapped += Cell_Tapped;
                    Grid.SetRow(border, row);
                    Grid.SetColumn(border, col);

                    var viewBox = new Viewbox();
                    Grid.SetRow(viewBox, row);
                    Grid.SetColumn(viewBox, col);

                    SudokuSolverGrid.Children.Add(viewBox);
                    SudokuSolverGrid.Children.Add(border);
                    viewBox.Child = cell;
                }
            }

            _values = SudokuSolverGrid.Children.Where(c => c is Viewbox).Select(c => (TextBlock)((Viewbox)c).Child).ToList();
            _borders = SudokuSolverGrid.Children.Where(c => c is Border).Select(c => (Border)c).ToList();
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///SplitPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            pageRoot = (NoelBlogReader.Common.LayoutAwarePage)this.FindName("pageRoot");
            itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("itemsViewSource");
            primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
            titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
            itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
            itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail");
            itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid");
            itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle");
            contentViewBorder = (Windows.UI.Xaml.Controls.Border)this.FindName("contentViewBorder");
            contentView = (Windows.UI.Xaml.Controls.WebView)this.FindName("contentView");
            contentViewRect = (Windows.UI.Xaml.Shapes.Rectangle)this.FindName("contentViewRect");
            itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
        }
        //-------------------------------------------------------------------------------
        #endregion (Util)

        //-------------------------------------------------------------------------------
        #region Constructor
        //-------------------------------------------------------------------------------
        //
        public ListPage()
        {
            this.InitializeComponent();
            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += navigationHelper_LoadState;
            this.navigationHelper.SaveState += navigationHelper_SaveState;

            CANVASES = new Canvas[] {
                    canvasMap1_E123, canvasMap1_E456, canvasMap1_W,
                    canvasMap2_E123, canvasMap2_E456, canvasMap2_W,
                    canvasMap3_E123, canvasMap3_E456, canvasMap3_W
                };
            SCROLLVIEWERS = new ScrollViewer[] {
                    scImgMap1_E123, scImgMap1_E456, scImgMap1_W,
                    scImgMap2_E123, scImgMap2_E456, scImgMap2_W,
                    scImgMap3_E123, scImgMap3_E456, scImgMap3_W
                };
            SELECT_BORDERS = new Border[] {
                borderMap1_E123, borderMap1_E456, borderMap1_W,
                borderMap2_E123, borderMap2_E456, borderMap2_W,
                borderMap3_E123, borderMap3_E456, borderMap3_W
            };
            RADIOBUTTONS = new RadioButton[] {
                rbSearch_Checklist, rbSearch_SearchString, rbSearch_Genre
            };
        }
Exemple #18
0
        public static void SimpleFlyout(object sender, string simpleMSG)
        {
            Flyout flyout = new Flyout();

            Border border = new Border();
            border.Width = 300;
            border.Height = 125;

            TextBlock tb = new TextBlock();
            tb.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            tb.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            tb.TextWrapping = TextWrapping.Wrap;
            tb.FontSize = 24.667;
            tb.Text = simpleMSG;
            tb.Foreground = new SolidColorBrush(Windows.UI.Colors.Black);
            border.Child = tb;

            flyout.Content = border;

            flyout.Placement = (PlacementMode)Enum.Parse(typeof(PlacementMode), "Top");
            flyout.PlacementTarget = sender as UIElement;

            flyout.IsOpen = true;

            ObjectTracker.Track(flyout);
        }
Exemple #19
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _progressBorder = GetTemplateChild("ProgressBorder") as Border;
            _border = GetTemplateChild("Border") as Border;

            this.SizeChanged += ProgressButton_SizeChanged;
        }
        public static Task<string> AuthenticateAsync(Uri uri)
        {
            var tcs = new TaskCompletionSource<string>();

              var w = new WebView
              {
            HorizontalAlignment = HorizontalAlignment.Stretch,
            VerticalAlignment = VerticalAlignment.Stretch,
            Margin = new Thickness(30.0),
              };

              var b = new Border
              {
            Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)),
            Width = Window.Current.Bounds.Width,
            Height = Window.Current.Bounds.Height,
            Child = w
              };

              var p = new Popup
              {
            Width = Window.Current.Bounds.Width,
            Height = Window.Current.Bounds.Height,
            Child = b,
            HorizontalOffset = 0.0,
            VerticalOffset = 0.0
              };

              Window.Current.SizeChanged += (s, e) =>
              {
            p.Width = e.Size.Width;
            p.Height = e.Size.Height;
            b.Width = e.Size.Width;
            b.Height = e.Size.Height;
              };

              w.Source = uri;

              w.NavigationCompleted += (sender, args) =>
              {
            if (args.Uri != null)
            {
              if (args.Uri.OriginalString.Contains("access_token"))
              {
            tcs.SetResult(args.Uri.ToString());
            p.IsOpen = false;
              }
              if (args.Uri.OriginalString.Contains("error=access_denied"))
              {
            tcs.SetResult(null);
            p.IsOpen = false;
              }
            }
              };

              p.IsOpen = true;
              return tcs.Task;
        }
Exemple #21
0
        protected WpfPanel()
        {
            border = new swc.Border
            {
#if TODO_XAML
                SnapsToDevicePixels = true,
                Focusable           = false,
#endif
            };
        }
        private void AddButton_Click_1(object sender, RoutedEventArgs e)
        {
            Border border = new Border();
            border.Height = RandomSize();
            border.Width = RandomSize();
            border.Margin = new Thickness(5);
            border.Background = RandomBackgroundColor();

            WrapPanel.Children.Add(border);
        }
Exemple #23
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                foreach (RuleGroup header in ReadDataHelper.GetAll<RuleGroup>())
                {
                    var stackPanel = new StackPanel
                    {
                        Orientation = Orientation.Horizontal,
                        Margin = new Thickness(0, 0, 0, 3),
                        Tag = header.Id + "|" + header.Text,
                    };

                    var border = new Border
                    {
                        Background = LayoutObjectFactory.GetThemeColor(),
                    };

                    int ruleGroupId = header.Id;
                    var ruleNumber = new TextBlock
                    {
                        Text = ruleGroupId < 10 ? "0" + ruleGroupId : ruleGroupId.ToString(),
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment = VerticalAlignment.Top,
                        Margin = new Thickness(10, 10, 10, 10),
                        FontSize = 36,
                    };

                    var text = new TextBlock
                    {
                        Text = header.Text,
                        HorizontalAlignment = HorizontalAlignment.Left,
                        VerticalAlignment = VerticalAlignment.Center,
                        Margin = new Thickness(10, 10, 10, 10),
                        FontSize = 24,
                        TextWrapping = TextWrapping.Wrap,
                        Width = Window.Current.Bounds.Width - 45
                    };

                    border.Child = ruleNumber;
                    stackPanel.Children.Add(border);
                    stackPanel.Children.Add(text);

                    stackPanel.Tapped += StackPanel_Tapped;

                    RulesPanel.Children.Add(stackPanel);
                }

                LayoutObjectFactory.AddBottomAppBar(this);
            }
            catch (Exception)
            {
                Frame.Navigate(typeof (ErrorPage));
            }
        }
Exemple #24
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Assembly assembly = typeof(MainPage).GetTypeInfo().Assembly;

            Stream pdfStream =
                assembly.GetManifestResourceStream("Xfinium.Pdf.Samples.Pro.WP81.PageThumbnails.xfinium.pdf");
            PdfFixedDocument document = new PdfFixedDocument(pdfStream);
            pdfStream.Dispose();

            int i = 0;

            pageThumbnailImages = new Image[document.Pages.Count];

            for (i = 0; i < document.Pages.Count; i++)
            {
                Border border = new Border();
                border.BorderThickness = new Thickness(1);
                border.BorderBrush = new SolidColorBrush(Colors.Black);
                border.Margin = new Thickness(10, 10, 0, 0);

                Image pageImage = new Image();
                border.Child = pageImage;
                pageThumbnailImages[i] = pageImage;

                pageThumbnails.Children.Add(border);
            }

            for (i = 0; i < document.Pages.Count; i++)
            {
                int index = i;

                var t = Task<PdfBgraByteRenderingSurface>.Factory.StartNew(() =>
                {
                    PdfPageRenderer renderer = new PdfPageRenderer(document.Pages[index]);
                    PdfBgraByteRenderingSurface rs = renderer.CreateRenderingSurface<PdfBgraByteRenderingSurface>(thumbnailDpi, thumbnailDpi);
                    PdfRendererSettings settings = new PdfRendererSettings(thumbnailDpi, thumbnailDpi, rs);
                    renderer.ConvertPageToImage(settings);

                    return rs;
                })
                    .ContinueWith(value =>
                    {
                        PdfBgraByteRenderingSurface rs = value.Result;
                        WriteableBitmap pageBitmap = new WriteableBitmap(rs.Width, rs.Height);
                        Stream imageStream = pageBitmap.PixelBuffer.AsStream();
                        imageStream.Write(rs.Bitmap, 0, rs.Bitmap.Length);

                        pageThumbnailImages[index].Width = pageBitmap.PixelWidth;
                        pageThumbnailImages[index].Height = pageBitmap.PixelHeight;
                        pageThumbnailImages[index].Source = pageBitmap;

                    }, TaskScheduler.FromCurrentSynchronizationContext());
            }
        }
Exemple #25
0
        /////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Method initializes and sets background appearance
        /// </summary>
        private void InitializeBackground()
        {
            background        = new UIX.Shapes.Rectangle();
            background.Margin = new UIX.Thickness(0);

            backgroundBorder = new Border();
            Color borderColor = Colors.White;

            backgroundBorder.BorderBrush     = new UIX.Media.SolidColorBrush(borderColor);
            backgroundBorder.BorderThickness = new UIX.Thickness(2);
            backgroundBorder.Child           = background;
        }
 public void Render(Border border)
 {
     GC.Collect();
     if (border == null)
     {
         throw new ArgumentNullException("border");
     }
     var richTextBlock = new RichTextBlock();
     border.Child = null;
     border.Child = richTextBlock;
     Render(richTextBlock);
 }
Exemple #27
0
		protected override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

#if WINDOWS_UWP
			_contentPresenter = GetTemplateChild("ContentPresenter") as WContentPresenter;	
#else
			_border = GetTemplateChild("Border") as Border;
#endif
			UpdateBackgroundColor();
			UpdateBorderRadius();
		}
        public cardViewer()
        {
            this.InitializeComponent();
            this.cardGrid.PointerPressed += cardGrid_PointerPressed;
            this.cardGrid.PointerExited += cardGrid_PointerReleased;
            this.cardGrid.PointerReleased += cardGrid_PointerReleased;

            for (int i = 0; i < 8; i++)
            {
                Border b = new Border();
            }
        }
Exemple #29
0
 public CheckBoxHandler()
 {
     Control = new swc.CheckBox {
         IsThreeState      = false,
         VerticalAlignment = sw.VerticalAlignment.Center
     };
     Control.Checked       += (sender, e) => Callback.OnCheckedChanged(Widget, EventArgs.Empty);
     Control.Unchecked     += (sender, e) => Callback.OnCheckedChanged(Widget, EventArgs.Empty);
     Control.Indeterminate += (sender, e) => Callback.OnCheckedChanged(Widget, EventArgs.Empty);
     border = new swc.Border {
         Child = Control
     };
 }
        private void Image_Tapped_1(object sender, TappedRoutedEventArgs e)
        {
            newSelectedImage = (Image)sender;
            newSelectedImage.Opacity = 0.6;

            if(previouslySelect!=null)
                previouslySelect.BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.White);

            Border bb = (Border)newSelectedImage.Parent;
            bb.BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Gray);
            previouslySelect = bb;
            BottomAppBar.IsOpen = true;
        }
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            scrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)GetTemplateChild(ScrollViewerControl);
            scrollViewer.ViewChanging += ScrollViewer_ViewChanging;
            scrollViewer.Margin = new Thickness(0, 0, 0, -RefreshHeaderHeight);
            var transform = new CompositeTransform();
            transform.TranslateY = -RefreshHeaderHeight;
            scrollViewer.RenderTransform = transform;

            containerGrid = (Grid)GetTemplateChild(ContainerGrid);
            pullToRefreshIndicator = (Border)GetTemplateChild(PullToRefreshIndicator);
            SizeChanged += OnSizeChanged;
        }
        /// <summary>
        /// Selects specified border
        /// </summary>
        /// <param name="_Border">Border to be highlight</param>
        public static void SelectBorder(Border _Border)
        {
            // Create Image object
            Image _Image = new Image();
            _Image.Source = new BitmapImage(new Uri("ms-appx:///Resource/Images/Icon_Select.png"));

            // Create ImageBrush to set Backgroun of _Border
            ImageBrush _ImageBrush = new ImageBrush();
            _ImageBrush.ImageSource = _Image.Source;

            // Set Background
            _Border.Background = _ImageBrush;
            //_Border.Width = 160;    // Comment this line and see what happens
        }
        private void AddItemsToWrapPanel(object sender, RoutedEventArgs e)
        {
            int numItems = Int32.Parse((string)((FrameworkElement)sender).Tag);

            while (numItems-- > 0)
            {
                Border b = new Border() { 
                Width = 100, Height = 100, 
                Background = new SolidColorBrush(Color.FromArgb(255, (byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256))), 
                BorderThickness = new Thickness(2), Margin=new Thickness(8) };

                wp.Children.Add(b);
            }
        }
Exemple #34
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            sc     = (WC.ScrollViewer) this.GetTemplateChild("sc");
            r1     = (WC.RowDefinition) this.GetTemplateChild("r1");
            r3     = (WC.RowDefinition) this.GetTemplateChild("r3");
            border = (WC.Border) this.GetTemplateChild("border");

            sc.ViewChanged += Sc_ViewChanged;

            this.PointerEntered += DataPicker_PointerEntered;
            this.PointerExited  += DataPicker_PointerExited;
        }
Exemple #35
0
        public void CreateControl(int cols, int rows)
        {
            controls        = new Control[cols, rows];
            columnScale     = new bool[cols];
            rowScale        = new bool[rows];
            lastColumnScale = cols - 1;
            lastRowScale    = rows - 1;
            Control         = new swc.Grid {
#if TODO_XAML
                SnapsToDevicePixels = true
#endif
            };
            for (int i = 0; i < cols; i++)
            {
                Control.ColumnDefinitions.Add(new swc.ColumnDefinition {
                    Width = GetColumnWidth(i)
                });
            }
            for (int i = 0; i < rows; i++)
            {
                Control.RowDefinitions.Add(new swc.RowDefinition {
                    Height = GetRowHeight(i)
                });
            }

            for (int y = 0; y < rows; y++)
            {
                for (int x = 0; x < cols; x++)
                {
                    Control.Children.Add(EmptyCell(x, y));
                }
            }

            border = new swc.Border {
                Child = Control
            };

            Spacing = Size.Empty;
            Padding = Padding.Empty;

            Control.SizeChanged += (s, e) => SetChildrenSizes();
            Control.Loaded      += (s, e) => SetChildrenSizes();
        }