コード例 #1
0
ファイル: PageHeader.cs プロジェクト: liptonbeer/Template10
 private void UpdateMarginToFitHamburgerMenu(HamburgerMenu hamburgerMenu = null)
 {
     hamburgerMenu = hamburgerMenu ?? ParentHamburgerMenu;
     if (hamburgerMenu == null)
     {
         Margin = new Thickness(0);
         return;
     }
     switch (hamburgerMenu.DisplayMode)
     {
         case SplitViewDisplayMode.Overlay:
             {
                 var buttonVisible = hamburgerMenu.HamburgerButtonVisibility == Visibility.Visible;
                 Margin = buttonVisible ? new Thickness(0) : new Thickness(48, 0, 0, 0);
             }
             break;
         case SplitViewDisplayMode.Inline:
         case SplitViewDisplayMode.CompactOverlay:
         case SplitViewDisplayMode.CompactInline:
             {
                 Margin = new Thickness(0);
             }
             break;
     }
 }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: Caverat/TicTacToe
        private void AddButtons(int count)
        {
            for (int i = 0; i < count; i++)
            {
                this.GameBoard.ColumnDefinitions.Add(new ColumnDefinition());
                this.GameBoard.RowDefinitions.Add(new RowDefinition());
            }

            Button button;

            for (int x = 0; x < count; x++)
            {
                for (int y = 0; y < count; y++)
                {
                    button = new Button();
                    button.HorizontalAlignment = HorizontalAlignment.Stretch;
                    button.VerticalAlignment = VerticalAlignment.Stretch;
                    button.SetValue(Grid.ColumnProperty, x);
                    button.SetValue(Grid.RowProperty, y);

                    Thickness margin = new Thickness(10);
                    button.Margin = margin;

                    this.GameBoard.Children.Add(button);
                }
            }
        }
コード例 #3
0
		async void RenderPictures()
		{
			var service = new JDanielSmith.PictureOfTheDay.Service();
			var thickness = new Thickness(0, 0, 50, 100);

			foreach (var name in service.Names)
			{
				var image = new Image() { Stretch = Stretch.Fill, Margin = thickness };

				const int offset = 25;
				thickness = new Thickness(thickness.Left + offset, thickness.Top + offset, thickness.Right - offset, thickness.Bottom - offset);
				this.grid1.Children.Add(image);

				var result = await service.GetPictureAsync(name);

				//var bitmapImage = new BitmapImage(result.Url);
				var bitmapImage = new BitmapImage();
				// http://jebarson.info/post/2012/03/14/byte-array-to-bitmapimage-converter-irandomaccessstream-implementation-for-windows-8-metro.aspx (see comment)
				using (var ms = new Windows.Storage.Streams.InMemoryRandomAccessStream())
				{
					await result.Image.WriteContentAsync(ms.AsStreamForWrite());
					ms.Seek(0);

					await bitmapImage.SetSourceAsync(ms);
				}

				image.Source = bitmapImage;
			}
		}
コード例 #4
0
ファイル: Utils.cs プロジェクト: ChrisCross67/wpfspark
 /// <summary>
 /// Deflates rectangle by given thickness
 /// </summary>
 /// <param name="rect">Rectangle</param>
 /// <param name="thick">Thickness</param>
 /// <returns>Deflated Rectangle</returns>
 public static Rect Deflate(this Rect rect, Thickness thick)
 {
     return new Rect(rect.Left + thick.Left,
         rect.Top + thick.Top,
         Math.Max(0.0, rect.Width - thick.Left - thick.Right),
         Math.Max(0.0, rect.Height - thick.Top - thick.Bottom));
 }
コード例 #5
0
 void AdjustMargins(
     ref double left,
     ref double right,
     ref double top,
     ref double bottom,
     ref double w,
     ref double h,
     ref double l0,
     ref double r0,
     ref double t0,
     ref double b0)
 {
     Windows.UI.Xaml.Thickness thickness = _view.Margin;
     l0 = left = (thickness.Left != 0.0) ? thickness.Left : Math.Max(left, l0);
     r0 = right = (thickness.Right != 0.0) ? (CurrentSize.Width - thickness.Right) : Math.Min(right, r0);
     t0 = top = (thickness.Top != 0.0) ? thickness.Top : Math.Max(top, t0);
     b0 = bottom = (thickness.Bottom != 0.0) ? (CurrentSize.Height - thickness.Bottom) : Math.Min(bottom, b0);
     w  = right - left;
     h  = bottom - top;
     if (w < 1.0)
     {
         w = 1.0;
     }
     if (h < 1.0)
     {
         h = 1.0;
     }
 }
コード例 #6
0
ファイル: MainView.xaml.cs プロジェクト: obiwan007/bettrdiet
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     previousWidth = HeroSection.Width;
     previousHeight = HeroSection.Height;
     previousMargin = HeroSection.Margin;
 }
コード例 #7
0
 /// <summary>
 /// Provides derived classes an opportunity to handle changes
 /// to the HighlightBounds property.
 /// </summary>
 /// <param name="oldHighlightBounds">The old HighlightBounds value</param>
 /// <param name="newHighlightBounds">The new HighlightBounds value</param>
 private void OnHighlightBoundsChanged(
     Thickness oldHighlightBounds, Thickness newHighlightBounds)
 {
     this.HighlightRect.Margin = newHighlightBounds;
     this.UpdateExtendedLinesPositions();
     this.UpdateHighlightTextPosition();
 }
コード例 #8
0
        private void CreateControl()
        {
            var grid = new Grid();

            var margin = new Thickness {Top = 24};

            grid.Margin = margin;

            var distinctEdgesCheckBox = new CheckBox {Margin = margin, VerticalAlignment = VerticalAlignment.Center};

            var padding = new Thickness {Left = 12, Right = 12};
            distinctEdgesCheckBox.Padding = padding;

            var textBlock = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Center,
                FontSize = FilterControlTitleFontSize,
                Text = _resourceLoader.GetString("DistinctEdges/Text")
            };

            distinctEdgesCheckBox.Content = textBlock;
            distinctEdgesCheckBox.IsChecked = Filter.DistinctEdges;
            distinctEdgesCheckBox.Checked += distinctEdgesCheckBox_Checked;
            distinctEdgesCheckBox.Unchecked += distinctEdgesCheckBox_Unchecked;

            var rowDefinition = new RowDefinition {Height = GridLength.Auto};
            grid.RowDefinitions.Add(rowDefinition);

            var columnDefinition = new ColumnDefinition {Width = GridLength.Auto};
            grid.ColumnDefinitions.Add(columnDefinition);

            grid.Children.Add(distinctEdgesCheckBox);

            Control = grid;
        }
コード例 #9
0
        private async void PerformFaceAnalysis(StorageFile file)
        {
            var imageInfo = await FileHelper.GetImageInfoForRendering(file.Path);
            NewImageSizeWidth = 300;
            NewImageSizeHeight = NewImageSizeWidth*imageInfo.Item2/imageInfo.Item1;

            var newSourceFile = await FileHelper.CreateCopyOfSelectedImage(file);
            var uriSource = new Uri(newSourceFile.Path);
            SelectedFileBitmapImage = new BitmapImage(uriSource);


            // start face api detection
            var faceApi = new FaceApiHelper();
            DetectedFaces = await faceApi.StartFaceDetection(newSourceFile.Path, newSourceFile, imageInfo, "4c138b4d82b947beb2e2926c92d1e514");

            // draw rectangles 
            var color = Color.FromArgb(125, 255, 0, 0);
            var bg = new SolidColorBrush(color);

            DetectedFacesCanvas = new ObservableCollection<Canvas>();
            foreach (var detectedFace in DetectedFaces)
            {
                var margin = new Thickness(detectedFace.RectLeft, detectedFace.RectTop, 0, 0);
                var canvas = new Canvas()
                {
                    Background = bg,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    Height = detectedFace.RectHeight,
                    Width = detectedFace.RectWidth,
                    Margin = margin
                };
                DetectedFacesCanvas.Add(canvas);
            }
        }
コード例 #10
0
 public CommandBarGridView()
 {
     this.Loaded += (s, a) =>
     {
         AppShell.Current.TogglePaneButtonRectChanged += Current_TogglePaneButtonSizeChanged;
         Margin = new Thickness(AppShell.Current.TogglePaneButtonRect.Right, 0, 0, 0);
     };
 }
コード例 #11
0
ファイル: TreeToggleButton.cs プロジェクト: mhusen/Eto
		public void Configure (ITreeGridItem item)
		{
			Item = item;
			var index = Controller.IndexOf (item);
			IsChecked = Controller.IsExpanded (index);
			Visibility = item != null && item.Expandable ? Visibility.Visible : Visibility.Hidden;
			Margin = new Thickness (Controller.LevelAtRow (index) * LevelWidth, 0, 0, 0);
		}
コード例 #12
0
ファイル: ParagraphStyle.cs プロジェクト: ridomin/waslibs
        public void Merge(ParagraphStyle style)
        {
            if (style != null)
            {
                Margin = Margin.Merge(style.Margin);

                base.Merge(style);
            }
        }
コード例 #13
0
 public void ShowSettingsPanel()
 {
     Thickness th = new Thickness(0);
     settingsCtrl.Margin = th;
     settingsCtrl.Visibility = Visibility.Visible;
     settingsCtrl.Initialize(_viewModel);
     // PointerPressed dismisses SettingsPanel
     this.PointerPressed += new PointerEventHandler(HideSettingsPanel);
 }
コード例 #14
0
ファイル: Block.cs プロジェクト: housemeow/OurSecrets
 public Block()
 {
     _image = new Image();
     _image.Source = new BitmapImage(new Uri("ms-appx:/Assets/test.png"));
     _image.Height = 160;
     _image.Width = 100;
     _thickness = new Thickness(0, 0, 0, 0);
     _image.Margin = _thickness;
 }
コード例 #15
0
ファイル: CastDialog.cs プロジェクト: tapanila/SharpCaster
 protected override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     Margin = new Thickness { Left = Window.Current.Bounds.Width * 0.05};
     Width = Window.Current.Bounds.Width * 0.9;
     Height = Window.Current.Bounds.Height * 0.9;
     var chromecasts = GetTemplateChild("ChromecastListView") as ListView;
     chromecasts.DataContext = this;
     if (chromecasts != null) chromecasts.Tapped += Chromecast_Tapped;
 }
コード例 #16
0
ファイル: Platform.cs プロジェクト: okhosting/OKHOSTING.UI
		public virtual Windows.UI.Xaml.Thickness Parse(Thickness thickness)
		{
			Windows.UI.Xaml.Thickness nativeThickness = new Windows.UI.Xaml.Thickness();

			if (thickness.Left.HasValue) nativeThickness.Left = (int)thickness.Left;
			if (thickness.Top.HasValue) nativeThickness.Top = (int)thickness.Top;
			if (thickness.Right.HasValue) nativeThickness.Right = (int)thickness.Right;
			if (thickness.Bottom.HasValue) nativeThickness.Bottom = (int)thickness.Bottom;

			return nativeThickness;
		}
コード例 #17
0
        private async Task ProcessImageAsync()
        {
            var bitmapImage = new BitmapImage();

            try
            {
                using (var client = new HttpClient())
                {
                    using (var stream = await client.GetStreamAsync(new Uri(BlobUrl)))
                    {
                        var memoryStream = new MemoryStream();
                        await stream.CopyToAsync(memoryStream);
                        memoryStream.Position = 0;
                        bitmapImage.SetSource(memoryStream.AsRandomAccessStream());
                    }
                }
            }
            catch (Exception ex)
            { }
            //InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream();
            //var httpClient = new HttpClient();
            //var webReq = (HttpWebRequest)WebRequest.Create(BlobUrl);
            //var httpClient.re

            //using (WebResponse response = await webReq.GetResponseAsync())
            //{
            //    using (Stream responseStream = response.GetResponseStream())
            //    {
            //        try
            //        {
            //            responseStream.CopyTo(stream);
            //        }
            //        catch (Exception ex)
            //        { }
            //    }
            //}

            //var image = new BitmapImage();
            //image.SetSource(stream);
            //Image = image;

            Image = bitmapImage;

            var scale = 350.0 / Image.PixelWidth;
            FaceBoxWidth = FaceRectangle.Width * scale;
            FaceBoxHeight = FaceRectangle.Height * scale;
            FaceBoxMargin = new Thickness(FaceRectangle.Left * scale, FaceRectangle.Top * scale, 0, 0);

            OnPropertyChanged("Image");
            OnPropertyChanged("FaceBoxWidth");
            OnPropertyChanged("FaceBoxHeight");
            OnPropertyChanged("FaceBoxMargin");
        }
コード例 #18
0
        public SegmentSurveyComboBox()
        {
            this.DefaultStyleKey = typeof(ComboBox);
            SelectionChanged += ComboBox_OnSelectionChanged;
            DataContextChanged += ComboBox_OnDataContextChanged;

            FontFamily = new FontFamily("Segoe UI");
            FontSize = 15;
            Margin = new Thickness(0, 2, 10, 0);

            Loaded += ComboBox_OnLoaded;
        }
コード例 #19
0
        private void PageHeader_Loaded(object sender, RoutedEventArgs e)
        {
            this.dataExchangeService = ((App)App.Current).Scope.Resolve<IDataExchangeService>();

            this.dataExchangeService.DataExchangeStarted += UpdateProgressIndicator;
            this.dataExchangeService.DataExchangeComplete += UpdateProgressIndicator;

            var margin = Margin;
            margin = new Thickness(margin.Left, margin.Top + 5, margin.Right, margin.Bottom);
            Margin = margin;
            UpdateProgressIndicator(sender, null);
        }
コード例 #20
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            var isSmallRes = WindowHelper.IsSmallResolution();

            var tileHeight = !isSmallRes ? new[] { 410, 270, 270, 270, 130 } : new[] { 270, 130, 130, 130, 130 };

            var driver = value as Driver;

            var percent = driver.Rate.AvgRate * (tileHeight[driver.Index] - 20) / 10;
            var margin = new Thickness { Left = 0, Top = 0, Right = 0, Bottom = percent };
            return margin;
        }
コード例 #21
0
ファイル: VerticalHubPage.xaml.cs プロジェクト: mbin/Win81App
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     PopulateImages();
     PopulateWidgets();
     PopulateStates();
     cvs1.Source = images;
     cvs2.Source = widgets;
     cvs3.Source = states;
     previousWidth = HeroSection.Width;
     previousHeight = HeroSection.Height;
     previousMargin = HeroSection.Margin;
 }
コード例 #22
0
ファイル: ResponsiveRow.cs プロジェクト: ridomin/waslibs
        protected override Size MeasureOverride(Size availableSize)
        {
            double height = availableSize.Width / this.AspectRatio;
            height = Math.Max(height, this.MinHeight);
            height = Math.Min(height, this.MaxHeight);

            double ratio = Math.Min(2, height / this.MinHeight);
            this.RelativePadding = new Thickness(this.Padding.Left * ratio, this.Padding.Top * ratio, this.Padding.Right * ratio, this.Padding.Bottom * ratio);

            var size = new Size(availableSize.Width, height);
            base.MeasureOverride(size);
            return size;
        }
コード例 #23
0
ファイル: MainPage.xaml.cs プロジェクト: housemeow/OurSecrets
 public MainPage()
 {
     this.InitializeComponent();
     _blocksList = new List<Block>();
     _textBox.Text = _blocksList.Count.ToString();
     //_imgSanta.ManipulationMode = ManipulationModes.All;
     _imgSanta.PointerPressed += OnPointerPressed;
     _imgSanta.PointerMoved += OnPointerMoved;
     _imgSanta.PointerReleased += OnPointerReleased;
     //_imgSanta.ManipulationStarted += StartedImageManipulation;
     _thickness = new Thickness(200, 0, 0, 0);
     _imgSanta.Margin = _thickness;
     _isPressed = false;
 }
コード例 #24
0
        public SegmentSurveyTextBox()
        {
            DefaultStyleKey = typeof(TextBox);

            FontFamily = new FontFamily("Segoe UI");
            FontSize = 15;
            Margin = new Thickness(0, 5, 10, 0);

            LostFocus += TextBox_OnLostFocus;
            DataContextChanged += TextBox_OnDataContextChanged;
            Loaded += TextBox_OnLoaded;

            IsDataValid = true;
        }
コード例 #25
0
 public virtual void UpdateCommonProperties(SplitViewDisplayMode splitViewDisplayMode)
 {
     if (splitViewDisplayMode == SplitViewDisplayMode.Overlay)
     {
         PageTitleMargin = new Thickness(69, 0, 12, 0);
     }
     else
     {
         PageTitleMargin = new Thickness(21, 0, 12, 0);
         AppBarRow = 0;
         AppBarColumn = 1;
         AppBarColumnSpan = 1;
     }
 }
コード例 #26
0
ファイル: Toastinet.xaml.cs プロジェクト: CarteKiwi/Toastinet
        /// <summary>
        /// Constructor
        /// </summary>
        public Toastinet()
        {
            InitializeComponent();

            // Default Padding
            Padding = new Thickness(10);

            Loaded += (s, e) =>
            {
                _isLoaded = true;
                NotifyChanged();
                VisualStateManager.GoToState(this, GetValidAnimation() + "Closed", false);
            };
        }
コード例 #27
0
 public static Thickness Merge(this Thickness thickness, Thickness thickness2)
 {
     if (!double.IsNaN(thickness2.Top) && thickness != thickness2)
     {
         return thickness2;
     }
     else if(double.IsNaN(thickness.Top))
     {
         return new Thickness();
     }
     else
     {
         return thickness;
     }
 }
コード例 #28
0
        private void Initialize()
        {
            this.BlurRadius    = 11;
            this.ShadowOpacity = 0.6;
            this.OffsetX       = 0;
            this.OffsetY       = 0;
            Margin             = new Windows.UI.Xaml.Thickness(8, 8, 4, 4);
            CanDrag            = false;
            Color = DropShadowPanelColor;
            HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Center;

            this.Content = GetContent();
            SetSize();
        }
コード例 #29
0
        private static Thickness convertCore(Thickness value, string parameter, bool direction)
        {
            try
            {
                if (!cache.TryGetValue(parameter, out var numbers))
                {
                    cache[parameter] = numbers = parameter.ToString()
                                                 .Split(spliter, StringSplitOptions.RemoveEmptyEntries)
                                                 .Select(Operation.Parse)
                                                 .ToArray();
                }
                var l = value.Left;
                var r = value.Right;
                var t = value.Top;
                var b = value.Bottom;
                switch (numbers.Length)
                {
                case 1:
                    numbers[0].OperateOn(ref l, direction);
                    numbers[0].OperateOn(ref r, direction);
                    numbers[0].OperateOn(ref t, direction);
                    numbers[0].OperateOn(ref b, direction);
                    break;

                case 2:
                    numbers[0].OperateOn(ref l, direction);
                    numbers[0].OperateOn(ref r, direction);
                    numbers[1].OperateOn(ref t, direction);
                    numbers[1].OperateOn(ref b, direction);
                    break;

                case 4:
                    numbers[0].OperateOn(ref l, direction);
                    numbers[2].OperateOn(ref r, direction);
                    numbers[1].OperateOn(ref t, direction);
                    numbers[3].OperateOn(ref b, direction);
                    break;

                default:
                    throw new ArgumentException("Wrong format.", nameof(parameter));
                }
                return(new Thickness(l, t, r, b));
            }
            catch (FormatException ex)
            {
                throw new ArgumentException("Wrong format.", nameof(parameter), ex);
            }
        }
コード例 #30
0
ファイル: MainPage.xaml.cs プロジェクト: CatMsg/Project
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            splitView.IsPaneOpen = !splitView.IsPaneOpen;
            Thickness t = new Thickness();
            if (splitView.IsPaneOpen)
            {

                t.Left = 0;
                content.Margin = t;
            }
            else
            {
                t.Left = -50;
                content.Margin = t;
            }
        }
コード例 #31
0
 private void El0_Loaded(object sender, RoutedEventArgs e)
 {
     loading.Completed += Loading_Completed;
     finish.Completed += Finish_Completed;
     start.Completed += Start_Completed;
     var m = el0.Height / 3;
     var t = new Thickness(m, 0, m, 0);
     el0.Margin = t;
     el1.Margin = t;
     el2.Margin = t;
     rootHeightOut.Value = el0.Height + 64d;
     if (IsActive)
     {
         start.Begin();
     }
 }
コード例 #32
0
ファイル: Converters.cs プロジェクト: veleek/DominionPicker
        public object ConvertBack(object value, Type targetType, object parameter, string culture)
        {
            Double baseValue = 0;

            if (value is Windows.UI.Xaml.Thickness)
            {
                Windows.UI.Xaml.Thickness thickness = (Windows.UI.Xaml.Thickness)value;
                // Assuming a uniform thickness so just take the first value
                baseValue = thickness.Left;
            }
            else
            {
                baseValue = System.Convert.ToDouble(value);
            }
            Double scaleValue = System.Convert.ToDouble(parameter);

            return(System.Convert.ChangeType(baseValue / scaleValue, targetType));
        }
コード例 #33
0
ファイル: ThemeConverter.cs プロジェクト: Daoting/dt
 static Windows.UI.Xaml.Thickness ParseThickness(string s)
 {
     Windows.UI.Xaml.Thickness thickness = new Windows.UI.Xaml.Thickness();
     if (string.IsNullOrEmpty(s))
     {
         return(thickness);
     }
     string[] strArray = s.Split(new char[] { ',', ' ' });
     if (strArray.Length == 1)
     {
         return(new Windows.UI.Xaml.Thickness(double.Parse(strArray[0], (IFormatProvider)CultureInfo.InvariantCulture)));
     }
     if (strArray.Length != 4)
     {
         throw new FormatException(string.Format("String {0} does not represent Thickness", (object[])new object[] { s }));
     }
     return(new Windows.UI.Xaml.Thickness(double.Parse(strArray[0], (IFormatProvider)CultureInfo.InvariantCulture), double.Parse(strArray[1], (IFormatProvider)CultureInfo.InvariantCulture), double.Parse(strArray[2], (IFormatProvider)CultureInfo.InvariantCulture), double.Parse(strArray[3], (IFormatProvider)CultureInfo.InvariantCulture)));
 }
コード例 #34
0
		public HorizontalHtmlGenerator(WebView webView)
		{
			this.webView = webView;

			Foreground = ((SolidColorBrush)webView.Resources["ApplicationForegroundThemeBrush"]).Color;
			Background = ((SolidColorBrush)webView.Resources["ApplicationPageBackgroundThemeBrush"]).Color;

			ColumnWidth = 400;
			RuleWidth = 40;
			HeaderWidth = 600; 
			
			Padding = new Thickness(140, 0, 40, 40);

			LaunchExternalBrowser = true; 
			
			webView.SizeChanged += delegate { Update(); };
			webView.ScriptNotify += OnScriptNotify;
		}
コード例 #35
0
 public MessageEntry(MalMessageModel msg)
 {
     Msg = msg;
     if (Msg.Sender.Equals(Credentials.UserName, StringComparison.CurrentCultureIgnoreCase))
     {
         HorizontalAlignment = HorizontalAlignment.Right;
         Margin = new Thickness(20, 0, 0, 0);
         CornerRadius = new CornerRadius(10, 10, 0, 10);
         Background = Application.Current.Resources["SystemControlHighlightAltListAccentLowBrush"] as Brush;
     }
     else
     {
         HorizontalAlignment = HorizontalAlignment.Left;
         Margin = new Thickness(0, 0, 20, 0);
         CornerRadius = new CornerRadius(10, 10, 10, 0);
         Background = Application.Current.Resources["SystemControlHighlightListAccentLowBrush"] as Brush;
         Background.Opacity = .5;
     }
 }
コード例 #36
0
ファイル: rMindBaseNode.cs プロジェクト: Korhog/rMind.Home
        public virtual void Init()
        {
            var r = m_connection_type == rMindNodeConnectionType.Container ? 10 : 3;

            m_label = new TextBlock
            {
                Visibility        = Visibility.Collapsed,
                IsHitTestVisible  = false,
                VerticalAlignment = VerticalAlignment.Center,
                Margin            = new Thickness(4, 0, 0, 0),
                FontSize          = 12,
                FontWeight        = FontWeights.SemiBold,
                FontFamily        = new FontFamily("Consolas"),
                Foreground        = new SolidColorBrush(Colors.White)
            };

            m_template.Children.Add(m_label);

            m_hit_area = new Rectangle
            {
                Fill = new SolidColorBrush(Colors.Transparent)
            };
            m_template.Children.Add(m_hit_area);

            m_area = new Rectangle {
                Width            = 20,
                Height           = 20,
                RadiusX          = r,
                RadiusY          = r,
                StrokeThickness  = 2,
                IsHitTestVisible = false,
                Fill             = new SolidColorBrush(Colors.Black),
                Stroke           = new SolidColorBrush(Colors.White)
            };

            UpdateAccentColor();

            Margin = new Windows.UI.Xaml.Thickness(2, 6, 2, 6);
            m_template.Children.Add(m_area);

            SubscribeInput();
        }
コード例 #37
0
ファイル: Converters.cs プロジェクト: veleek/DominionPicker
        public object Convert(object value, Type targetType, object parameter, string culture)
        {
            Double baseValue   = System.Convert.ToDouble(value);
            Double scalar      = System.Convert.ToDouble(parameter);
            Double scaledValue = baseValue * scalar;
            object result      = null;

            if (targetType == typeof(Windows.UI.Xaml.Thickness))
            {
                result = new Windows.UI.Xaml.Thickness(scaledValue);
            }
            else if (targetType == typeof(CornerRadius))
            {
                result = new CornerRadius(scaledValue);
            }
            else
            {
                result = System.Convert.ChangeType(scaledValue, targetType);
            }
            return(result);
        }
コード例 #38
0
ファイル: Platform.cs プロジェクト: nagyistge/OKHOSTING.UI
        public virtual Windows.UI.Xaml.Thickness Parse(Thickness thickness)
        {
            Windows.UI.Xaml.Thickness nativeThickness = new Windows.UI.Xaml.Thickness();

            if (thickness.Left.HasValue)
            {
                nativeThickness.Left = (int)thickness.Left;
            }
            if (thickness.Top.HasValue)
            {
                nativeThickness.Top = (int)thickness.Top;
            }
            if (thickness.Right.HasValue)
            {
                nativeThickness.Right = (int)thickness.Right;
            }
            if (thickness.Bottom.HasValue)
            {
                nativeThickness.Bottom = (int)thickness.Bottom;
            }

            return(nativeThickness);
        }
コード例 #39
0
        void SetMargins(sw.FrameworkElement c, int x, int y)
        {
            var margin = new sw.Thickness();

            if (x > 0)
            {
                margin.Left = spacing.Width / 2;
            }
            if (x < Control.ColumnDefinitions.Count - 1)
            {
                margin.Right = spacing.Width / 2;
            }
            if (y > 0)
            {
                margin.Top = spacing.Height / 2;
            }
            if (y < Control.RowDefinitions.Count - 1)
            {
                margin.Bottom = spacing.Height / 2;
            }
            c.HorizontalAlignment = sw.HorizontalAlignment.Stretch;
            c.VerticalAlignment   = sw.VerticalAlignment.Stretch;
            c.Margin = margin;
        }
コード例 #40
0
 public static T Margin <T>(this T element, Thickness margin) where T : IFrameworkElement
 {
     element.Margin = margin;
     return(element);
 }
コード例 #41
0
 protected void SetBorder(Thickness thickness, Brush brush)
 => BorderLayerRenderer.SetBorder(this, thickness, brush);
コード例 #42
0
 Windows.UI.Xaml.Thickness AddMargin(Windows.UI.Xaml.Thickness original, double left, double top, double right, double bottom)
 {
     return(new Windows.UI.Xaml.Thickness(original.Left + left, original.Top + top, original.Right + right, original.Bottom + bottom));
 }
コード例 #43
0
ファイル: Thickness.cs プロジェクト: shandan1/CollectionRef
 public bool Equals(Thickness thickness)
 {
     return(this == thickness);
 }
コード例 #44
0
        public EditorField()
#if __ANDROID__
            : base(Forms.Context)
#endif
        {
#if __IOS__
            BackgroundColor = Color.FromRgb(20, 20, 20);
#else
            BackgroundColor = Color.FromRgb(50, 50, 50);
#endif
            TextColor = Color.White;

#if __ANDROID__
            TextSize = 13f;

            rect  = new Android.Graphics.Rect();
            paint = new Android.Graphics.Paint();

            float paintSize = 26f;

            paint.SetStyle(Android.Graphics.Paint.Style.Fill);
            paint.Color    = Android.Graphics.Color.Gray;
            paint.TextSize = paintSize;

            SetPadding(2 * (int)paintSize, 0, 0, 0);

            ImeOptions = ImeAction.Done;
            SetRawInputType(Android.Text.InputTypes.ClassText);
#elif __IOS__
            ReturnKeyType      = UIReturnKeyType.Done;
            Delegate           = this;
            AutocorrectionType = UITextAutocorrectionType.No;
#elif __UWP__
            Window.Current.CoreWindow.KeyDown += (s, e) =>
            {
                var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control);
                if (ctrl.HasFlag(CoreVirtualKeyStates.Down) && e.VirtualKey == VirtualKey.S)
                {
                    if (EditingEnded != null)
                    {
                        EditingEnded(this, EventArgs.Empty);
                    }
                }
            };

            BorderThickness = new Windows.UI.Xaml.Thickness(0, 0, 0, 0);

            string hover   = "PointerOver";
            string focused = "Focused";

            string textColor       = "#ffffff";
            string backgroundColor = "#2a2a2a";

            Resources["TextControlForeground"]           = textColor;
            Resources["TextControlForeground" + hover]   = textColor;
            Resources["TextControlForeground" + focused] = textColor;

            Resources["TextControlBackground"]           = backgroundColor;
            Resources["TextControlBackground" + hover]   = backgroundColor;
            Resources["TextControlBackground" + focused] = backgroundColor;

            IsSpellCheckEnabled = false;
#endif
        }
コード例 #45
0
ファイル: WpfExtensions.cs プロジェクト: nzysoft/Eto
 public static double Horizontal(this sw.Thickness thickness)
 {
     return(thickness.Left + thickness.Right);
 }
コード例 #46
0
ファイル: Conversions.Xaml.cs プロジェクト: daddycoding/Eto
 public static Padding ToEto(this sw.Thickness value)
 {
     return(new Padding((int)value.Left, (int)value.Top, (int)value.Right, (int)value.Bottom));
 }
コード例 #47
0
ファイル: WpfExtensions.cs プロジェクト: nzysoft/Eto
 public static wf.Size Size(this sw.Thickness thickness)
 {
     return(new wf.Size(thickness.Horizontal(), thickness.Vertical()));
 }
コード例 #48
0
ファイル: Platform.cs プロジェクト: nagyistge/OKHOSTING.UI
 public virtual Thickness Parse(Windows.UI.Xaml.Thickness nativeThickness)
 {
     return(new Thickness(nativeThickness.Left, nativeThickness.Top, nativeThickness.Right, nativeThickness.Bottom));
 }
コード例 #49
0
ファイル: WpfExtensions.cs プロジェクト: nzysoft/Eto
 public static double Vertical(this sw.Thickness thickness)
 {
     return(thickness.Top + thickness.Bottom);
 }
コード例 #50
0
ファイル: ViewRenderer.cs プロジェクト: eroc218/xamarin
 void UpdateMargins()
 {
     Margin = new Windows.UI.Xaml.Thickness(Element.Margin.Left, Element.Margin.Top, Element.Margin.Right, Element.Margin.Bottom);
 }