当前位置: 首页>>代码示例>>C#>>正文


C# Border.SetValue方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.Border.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Border.SetValue方法的具体用法?C# Border.SetValue怎么用?C# Border.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.Border的用法示例。


在下文中一共展示了Border.SetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: buildColumn

		private void buildColumn(int dayOfWeek)
		{
			int row = 0;
			var end = new DateTime(1, 1, 2, 0, 0, 0);
			for (DateTime dt = new DateTime(1, 1, 1, 0, 0, 0); dt < end; dt = dt.AddMinutes(30))
			{
				Border b = new Border();
				b.SetValue(Grid.ColumnProperty, dayOfWeek);
				b.SetValue(Grid.RowProperty, row);
				b.Tag = new BorderTag()
				{
					DayOfWeek = dayOfWeek,
					CellDateTime = dt
				};
				b.Tapped += Border_Tapped;

				if (dt.Minute == 0)
				{
					b.Style = tempHourStart ?? (tempHourStart = this.TryFindResource("TempHourStart") as Style);
					b.HorizontalAlignment = HorizontalAlignment.Stretch;
					b.VerticalAlignment = VerticalAlignment.Stretch;

					TextBlock tb = new TextBlock();
					b.Child = tb;
					tb.Text = dt.ToString("h t").ToLower();
				}
				else
				{
					b.Style = tempHourEnd ?? (tempHourEnd = this.TryFindResource("TempHourEnd") as Style);
					b.HorizontalAlignment = HorizontalAlignment.Stretch;
					b.VerticalAlignment = VerticalAlignment.Stretch;

				}
				Calander.Children.Add(b);

				row++;
			}
		}
开发者ID:holtsoftware,项目名称:House,代码行数:38,代码来源:TemperatureSettingView.xaml.cs

示例2: CreateButton

 private void CreateButton(int i, int j)
 {
     var b = new Button
     {
         HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
         VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch,
         Tag = new Tuple<int, int>(i, j),
         Style = Application.Current.Resources["Unbordered"] as Style
     };
     b.Click += GameFieldButton_Click;
     var g = new Border { Background = WhiteBrush, Child = b, Margin = new Thickness(3), Padding = zeroThick };
     g.SetValue(Grid.RowProperty, i);
     g.SetValue(Grid.ColumnProperty, j);
     GameField.Children.Add(g);
     Field[i, j] = b;
 }
开发者ID:yhaskell,项目名称:Quarta,代码行数:16,代码来源:Play.xaml.cs

示例3: DivideGrid

        private void DivideGrid(int countGamers)
        {
            try
            {
                double angle = 360.0 / countGamers;
                double transformAngleLine = -90;
                double transformAngleNumber = 0;
                for (int i = 0; i < countGamers; i++)
                {
                    Line myLine = new Line();
                    transformAngleLine += angle;
                    transformAngleNumber = transformAngleLine - angle / 2;
                    string nameLine = "myLine" + i.ToString();
                    myLine.Stroke = new SolidColorBrush(colorLine);
                    myLine.X1 = LayoutRoot.ActualWidth / 2;
                    myLine.X2 = LayoutRoot.ActualWidth;
                    myLine.Y1 = LayoutRoot.ActualHeight / 2;
                    myLine.Y2 = LayoutRoot.ActualHeight / 2;
                    myLine.StrokeThickness = 3;
                    myLine.SetValue(Grid.RowProperty, 0);
                    myLine.SetValue(Grid.RowSpanProperty, 2);
                    myLine.Name = nameLine;
                    RotateTransform MyTransform = new RotateTransform();
                    myLine.RenderTransform = MyTransform;
                    myLine.RenderTransformOrigin = new Point(0.5, 0.5);
                    MyTransform.Angle = transformAngleLine;
                    LayoutRoot.Children.Add(myLine);

                    TextBlock numberGamer = new TextBlock();
                    numberGamer.Name = "number" + i.ToString();
                    numberGamer.Text = (i + 1).ToString();
                    numberGamer.HorizontalAlignment = HorizontalAlignment.Center;
                    numberGamer.VerticalAlignment = VerticalAlignment.Center;
                    numberGamer.FontSize = GridNumberGamer.ActualHeight * 80 / 100;
                    numberGamer.TextWrapping = TextWrapping.NoWrap;
                    numberGamer.FontFamily = new FontFamily("Comic Sans MS");

                    Border b = new Border();
                    Border b2 = new Border();
                    b.BorderThickness = b2.BorderThickness = new Thickness(3);
                    b.CornerRadius = b2.CornerRadius = new CornerRadius(20);
                    b.BorderBrush = b2.BorderBrush = new SolidColorBrush(colorLine);
                    b.Child = numberGamer;
                    b.Height = b.Width = b2.Height = b2.Width = GridNumberGamer.ActualHeight;

                    if (GridNumberGamer.ActualHeight > GridNumberGamer.ColumnDefinitions[1].ActualWidth)
                    {
                        b.Margin = b2.Margin = new Thickness(0, 0, -GridNumberGamer.ActualHeight + GridNumberGamer.ColumnDefinitions[1].ActualWidth, 0);
                    }
                    b2.Background = new SolidColorBrush(Colors.Black);
                    b2.Opacity = 0.4;
                    var radius = LayoutRoot.ActualHeight / 2 * 84 / 100;

                    var y0 = LayoutRoot.ActualHeight / 2 * 84 / 100;
                    var х1 = (Math.Cos(Math.PI * transformAngleNumber / 180) * radius);
                    var у1 = y0 + (Math.Sin(Math.PI * transformAngleNumber / 180) * radius);
                    MatrixTransform matrixTransform = new MatrixTransform();
                    b.RenderTransform = b2.RenderTransform = matrixTransform;
                    matrixTransform.Matrix = new Matrix(1, 0, 0, 1, х1, у1);

                    b2.SetValue(Grid.ColumnProperty, 1);
                    b.SetValue(Grid.ColumnProperty, 1);
                    GridNumberGamer.Children.Add(b2);
                    GridNumberGamer.Children.Add(b);
                    backButton.Height = GridNumberGamer.ActualHeight;
                }

                BottleImage = new Image();
                BottleImage.Name = "bottleImage";
                BottleImage.Source = new BitmapImage(new Uri(bottleRepository.GetBottle(numberBottle).Path, UriKind.RelativeOrAbsolute));
                BottleImage.RenderTransformOrigin = new Point(0.5, 0.5);
                RotateTransform rotateBottle = new RotateTransform();
                rotateBottle.Angle = 10;
                BottleImage.RenderTransform = rotateBottle;
                BottleImage.SetValue(Grid.RowProperty, 0);
                BottleImage.SetValue(Grid.RowSpanProperty, 2);
                BottleImage.Tapped += bottleImage_Start;
                BottleImage.PointerPressed += bottleImage_PointerPressed;
                BottleImage.Height = GridBottle.ActualHeight;
                BottleImage.HorizontalAlignment = HorizontalAlignment.Center;
                BottleImage.VerticalAlignment = VerticalAlignment.Center;
                LayoutRoot.Children.Add(BottleImage);
            }
            catch (Exception ex)
            {
                var a = ex.Message;
            }
        }
开发者ID:Julia-Bobko,项目名称:Bottle,代码行数:88,代码来源:Game.xaml.cs

示例4: buildGrid

        private void buildGrid(Grid parent, int[,] pixels)
        {
            parent.Children.Clear();
            var length = Processor.pixelsNum;
            for (int row = 0; row < length; row++)
            {
                for (int col = 0; col < length; col++)
                {
                    var color = getGrayScaleColor(pixels, row, col);
                    var border = new Border
                    {
                        Background = new SolidColorBrush(color),
                        BorderBrush = new SolidColorBrush(Colors.LightBlue),
                        BorderThickness = new Thickness(0.5),
                    };

                    border.SetValue(Grid.RowProperty, row);
                    border.SetValue(Grid.ColumnProperty, col);

                    parent.Children.Add(border);
                }
            }
        }
开发者ID:bryanhunter,项目名称:DigitRecognizer,代码行数:23,代码来源:MainPage.xaml.cs

示例5: CreateBorder

        private void CreateBorder(int x, int y)
        {
            var border = new Border
            {
                BorderThickness = new Thickness(BorderWidth),
                BorderBrush = new SolidColorBrush(Colors.WhiteSmoke)

            };

            border.BorderBrush.Opacity = .4f;

            border.SetValue(Grid.RowProperty, y);
            border.SetValue(Grid.ColumnProperty, x);
            GameBoard.Children.Add(border);
            _gridBorders.Add(border);
        }
开发者ID:jonathanyeung,项目名称:ozwego,代码行数:16,代码来源:GameBoardPrototype.xaml.cs

示例6: initializeGrid

        private void initializeGrid(VideoPlayerViewModel vm)
        {
            Playlist playlist = vm.Parameter.playlist;
            double screenWidth = Window.Current.Bounds.Width;
            string[] displayColumns = playlist.displayColumns;
            var template = @"<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""> <Grid MinWidth='" + screenWidth + "'> <Grid.ColumnDefinitions> @ </Grid.ColumnDefinitions> % </Grid> </DataTemplate>";
            string columnDefinitions = "";
            string rowText = "";
            if (displayColumns != null)
            {
                for (int i = 0; i < displayColumns.Length; i++)
                {
                    ColumnDefinition col = new ColumnDefinition();
                    col.Width = new GridLength(130);
                    gridHeaders.ColumnDefinitions.Add(col);
                    columnDefinitions += String.Format(@"<ColumnDefinition Width=""{0}"" /> ", COLUMN_WIDTH);
                    rowText = rowText + @"<TextBlock Grid.Column=""X"" HorizontalAlignment = ""Center"" TextWrapping=""NoWrap"" VerticalAlignment=""Center"" Text =""{Binding Path=breakDownData[X]}""/>".Replace("X", i.ToString());
                    Border b = new Border();
                    b.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0, 0, 0));
                    b.BorderThickness = new Thickness(0, 0, 2, 0);
                    TextBlock t = new TextBlock();
                    Run text = new Run();
                    vm.GridHeadersTextSorted.Add(trimHeaderText(displayColumns[i], true));
                    vm.GridHeadersTextUnsorted.Add(trimHeaderText(displayColumns[i], false));
                    text.Text = vm.GridHeadersTextUnsorted.Last();
                    t.Inlines.Add(text);
                    b.SetValue(Grid.RowProperty, 0);
                    b.SetValue(Grid.ColumnProperty, i);
                    t.Style = (Style)Application.Current.Resources["VideoPlayer_TextBlockStyle_GridHeader"];

                    t.Tag = i;
                    t.PointerReleased += columnHeaderClick;

                    b.Child = t;
                    t.FontSize = GRID_HEADER_FONT_SIZE;
                    gridHeaders.Children.Add(b);
                }
            }
            template = template.Replace("@", columnDefinitions).Replace("%", rowText);

            var dt = (DataTemplate)XamlReader.Load(template);
            FilteredClips.ItemTemplate = dt;
        }
开发者ID:jwiese-ms,项目名称:hudl-win8,代码行数:43,代码来源:VideoPlayerView.xaml.cs


注:本文中的Windows.UI.Xaml.Controls.Border.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。