本文整理汇总了C#中System.Windows.Controls.Grid.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.GetValue方法的具体用法?C# Grid.GetValue怎么用?C# Grid.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Grid
的用法示例。
在下文中一共展示了Grid.GetValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BottomLeftDown
private void BottomLeftDown(Grid grid, UIElement source)
{
var gridtop = (double)grid.GetValue(Canvas.TopProperty);
var gridleft = (double)grid.GetValue(Canvas.LeftProperty);
// 横
Line1.X1 = 32;
Line1.Y1 = gridtop + grid.Width - 32;
Line1.X2 = gridleft + 32;
Line1.Y2 = gridtop + grid.Width - 32;
// 縦
Line2.X1 = gridleft + 32;
Line2.Y1 = Height - 48;
Line2.X2 = gridleft + 32;
Line2.Y2 = gridtop + grid.Width - 32;
Line1.Visibility = System.Windows.Visibility.Visible;
Line2.Visibility = System.Windows.Visibility.Visible;
topLeft.Background = new SolidColorBrush(Colors.White);
topRight.Background = new SolidColorBrush(Colors.White);
bottomLeft.Background = new SolidColorBrush(Colors.Red);
bottomRight.Background = new SolidColorBrush(Colors.White);
}
示例2: Defaults
public void Defaults()
{
Grid g = new Grid();
Assert.AreEqual(0, g.GetValue(Grid.ColumnProperty), "#1");
Assert.AreEqual(1, g.GetValue(Grid.ColumnSpanProperty), "#2");
Assert.AreEqual(0, g.GetValue(Grid.RowProperty), "#3");
Assert.AreEqual(1, g.GetValue(Grid.RowSpanProperty), "#4");
Assert.AreEqual(false, g.GetValue(Grid.ShowGridLinesProperty), "#5"); // Succeeds in Silverlight 3
Rectangle r1 = new Rectangle();
Rectangle r2 = new Rectangle();
g.Children.Add(r1);
g.Children.Add(r2);
Assert.AreEqual(0, Grid.GetColumn(r1), "#6");
Assert.AreEqual(0, Grid.GetColumn(r2), "#7");
Assert.AreEqual(0, Grid.GetRow(r1), "#8");
Assert.AreEqual(0, Grid.GetRow(r2), "#9");
}
示例3: GetAutoRowDefinitions
public static AutoRowDefinitions GetAutoRowDefinitions(Grid element) { return (AutoRowDefinitions)element.GetValue(AutoRowDefinitionsProperty); }
示例4: OnNavigatedTo
//.........这里部分代码省略.........
}
#endregion
#region 创建方格和加载图片
ImageBrush berriesBrush = new ImageBrush();
berriesBrush.ImageSource =
new BitmapImage(
new Uri(@"bg_InGame.jpg", UriKind.Relative)
);
Carrier.Background = berriesBrush;
//Image Map = new Image();
//Map.Width = 480;
//Map.Height = 800;
//Map.Source = new BitmapImage((new Uri(@"bg_InGame.jpg", UriKind.Relative)));
//Carrier.Children.Add(Map);
//Map.SetValue(Canvas.ZIndexProperty, -1);//ZIndexProperty附加属性,这样它就相当于地图背景的作用
Touch.FrameReported += new TouchFrameEventHandler(Touch_FrameReported);
Table t = new Table(tableColumn, tableRow, smallSquareWidth, smallSquareHeight);
g = t.CreateTable();
Carrier.Children.Add(g);
littleImages = new MyImages(smallSquareWidth, smallSquareHeight);
List<Image> listImages = littleImages.CreateImages(imgsCount,imgUri);
try
{
foreach (var u in listImages)
{
Carrier.Children.Add(u);
}
}
catch
{ }
tableVectors = new vector2D[tableRow + 1, tableColumn + 1];
vector2D a = new vector2D();
for (int i = 0; i < tableRow + 1; i++)
{
for (int j = 0; j < tableColumn + 1; j++)
{
a.x = j * t.SmallSquareWidth + (480 - t.Column * t.SmallSquareWidth) / 2;
a.y = i * t.SmallSquareHeight;
tableVectors[i, j] = a;
}
}
#region 原图
originalImage.Name = "originalImage";
#region 从存储过程中读取原图
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
if (!isf.DirectoryExists(imgUri))
isf.CreateDirectory(imgUri);
string[] imgsNames = isf.GetFileNames(imgUri + "/originalImage*.jpg");
try
{
using (IsolatedStorageFileStream isfStream = isf.OpenFile(imgUri + "/" + imgsNames[0], FileMode.Open, FileAccess.Read))
{
BitmapImage bmpImg = new BitmapImage();
bmpImg.SetSource(isfStream);
originalImage.Source = bmpImg;
}
}
catch
{ }
#endregion
//originalImage.Source = new BitmapImage(new Uri("img/5And5/1/originalImage.jpg", UriKind.Relative));
originalImage.Width = g.Width;
originalImage.Height = g.Height;
Thickness gMargin = (Thickness)g.GetValue(MarginProperty);
Canvas.SetLeft(originalImage, gMargin.Left);
Canvas.SetTop(originalImage, gMargin.Top);
Canvas.SetZIndex(originalImage, -1);
try {
Carrier.Children.Add(originalImage);
}
catch
{
}
originalImage.Visibility = Visibility.Collapsed;
#endregion
#endregion
#region 读取独立存储空间
//switch (MusicName)
//{
// case "Set Fire To The Rain": ReadIsolatedStorageFile(highPointCount[0], 1);//读取独立存储空间的歌曲高潮点文件,highPointCount[]歌曲名,1文件名
// break;
// case "What Doesn't Kill You": ReadIsolatedStorageFile(highPointCount[1], 2);//读取独立存储空间的歌曲高潮点文件
// break;
// default: break;
//}
#endregion
}
示例5: BottomLeftUp
private void BottomLeftUp(Grid grid, UIElement source)
{
Line1.Visibility = System.Windows.Visibility.Collapsed;
Line2.Visibility = System.Windows.Visibility.Collapsed;
buttonState.Children.RemoveRange(1, 4);
buttonState = null;
// 移動先の設定
var gridtop = (double)grid.GetValue(Canvas.TopProperty);
var gridleft = (double)grid.GetValue(Canvas.LeftProperty);
// bottom + left を起点に変更する
var button = layoutDic[grid.Uid];
button.Top = double.MaxValue;
button.Bottom = Height - gridtop - grid.Height + 32;
button.Left = gridleft + 32;
button.Right = double.MaxValue;
}
示例6: TopRightUp
private void TopRightUp(Grid grid, UIElement source)
{
Line1.Visibility = System.Windows.Visibility.Collapsed;
Line2.Visibility = System.Windows.Visibility.Collapsed;
buttonState.Children.RemoveRange(1, 4);
buttonState = null;
var gridtop = (double)grid.GetValue(Canvas.TopProperty);
var gridleft = (double)grid.GetValue(Canvas.LeftProperty);
// top + right を起点に変更する
var button = layoutDic[grid.Uid];
button.Top = gridtop + 32;
button.Bottom = double.MaxValue;
button.Left = double.MaxValue;
button.Right = Width - gridleft - grid.Width + 32;
}
示例7: GetTargetColumn
public static int GetTargetColumn(Grid grid)
{
Guard.ArgumentNotNull(grid, "grid");
return (int)grid.GetValue(TargetColumnProperty);
}
示例8: GetDecrementKeyGesture
public static KeyGesture GetDecrementKeyGesture(Grid grid)
{
Guard.ArgumentNotNull(grid, "grid");
return (KeyGesture)grid.GetValue(DecrementKeyGestureProperty);
}
示例9: GetRows
/// <summary>
/// Gets the value of <see cref="RowsProperty"/> for a given <see cref="Grid"/>.
/// </summary>
/// <param name="obj">The given <see cref="Grid"/>.</param>
/// <returns>The value of <see cref="RowsProperty"/>.</returns>
public static string GetRows(Grid obj) => (string)obj.GetValue(RowsProperty);
示例10: GetColumns
/// <summary>
/// Gets the value of <see cref="ColumnsProperty"/> for a given <see cref="Grid"/>.
/// </summary>
/// <param name="obj">The given <see cref="Grid"/>.</param>
/// <returns>The value of <see cref="ColumnsProperty"/>.</returns>
public static string GetColumns(Grid obj) => (string)obj.GetValue(ColumnsProperty);
示例11: GetWith
public static string GetWith(Grid element)
{
return (string)element.GetValue(WithProperty);
}
示例12: GetRows
public static string GetRows(Grid element)
{
return (string)element.GetValue(RowsProperty);
}
示例13: GetColumns
public static string GetColumns(Grid element)
{
return (string)element.GetValue(ColumnsProperty);
}