當前位置: 首頁>>代碼示例>>C#>>正文


C# Xaml.Thickness類代碼示例

本文整理匯總了C#中Windows.UI.Xaml.Thickness的典型用法代碼示例。如果您正苦於以下問題:C# Thickness類的具體用法?C# Thickness怎麽用?C# Thickness使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Thickness類屬於Windows.UI.Xaml命名空間,在下文中一共展示了Thickness類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RenderPictures

		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;
			}
		}
開發者ID:JDanielSmith,項目名稱:Projects,代碼行數:29,代碼來源:MainPage.xaml.cs

示例2: CreateControl

        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;
        }
開發者ID:JuannyWang,項目名稱:filter-effects,代碼行數:35,代碼來源:MarvelFilter.cs

示例3: Deflate

 /// <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));
 }
開發者ID:ChrisCross67,項目名稱:wpfspark,代碼行數:13,代碼來源:Utils.cs

示例4: OnHighlightBoundsChanged

 /// <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();
 }
開發者ID:siatwangmin,項目名稱:WinRTXamlToolkit,代碼行數:13,代碼來源:HighlightOverlay.xaml.cs

示例5: UpdateMarginToFitHamburgerMenu

 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;
     }
 }
開發者ID:liptonbeer,項目名稱:Template10,代碼行數:25,代碼來源:PageHeader.cs

示例6: AddButtons

        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);
                }
            }
        }
開發者ID:Caverat,項目名稱:TicTacToe,代碼行數:27,代碼來源:MainPage.xaml.cs

示例7: PerformFaceAnalysis

        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);
            }
        }
開發者ID:modulexcite,項目名稱:ProjectOxford,代碼行數:35,代碼來源:MainPage.xaml.cs

示例8: CommandBarGridView

 public CommandBarGridView()
 {
     this.Loaded += (s, a) =>
     {
         AppShell.Current.TogglePaneButtonRectChanged += Current_TogglePaneButtonSizeChanged;
         Margin = new Thickness(AppShell.Current.TogglePaneButtonRect.Right, 0, 0, 0);
     };
 }
開發者ID:Adam8234,項目名稱:the-blue-alliance-windows,代碼行數:8,代碼來源:CommandBarGridView.cs

示例9: Configure

		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);
		}
開發者ID:mhusen,項目名稱:Eto,代碼行數:8,代碼來源:TreeToggleButton.cs

示例10: Block

 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;
 }
開發者ID:housemeow,項目名稱:OurSecrets,代碼行數:9,代碼來源:Block.cs

示例11: ShowSettingsPanel

 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);
 }
開發者ID:jayway,項目名稱:Kelly-Win8-XAML,代碼行數:9,代碼來源:MainPage.xaml.cs

示例12: OnApplyTemplate

 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;
 }
開發者ID:tapanila,項目名稱:SharpCaster,代碼行數:10,代碼來源:CastDialog.cs

示例13: Parse

		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;
		}
開發者ID:okhosting,項目名稱:OKHOSTING.UI,代碼行數:11,代碼來源:Platform.cs

示例14: SegmentSurveyComboBox

        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;
        }
開發者ID:yuqiqian,項目名稱:Copacescc,代碼行數:12,代碼來源:SegmentSurveyComboBox.cs

示例15: Convert

        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;
        }
開發者ID:EmiiFont,項目名稱:MyShuttle_RC,代碼行數:12,代碼來源:MyShuttleRateToMarginConverter.cs


注:本文中的Windows.UI.Xaml.Thickness類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。