本文整理汇总了C#中RowDefinition类的典型用法代码示例。如果您正苦于以下问题:C# RowDefinition类的具体用法?C# RowDefinition怎么用?C# RowDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowDefinition类属于命名空间,在下文中一共展示了RowDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExamineKeystrokes
public ExamineKeystrokes()
{
Title = "Examine Keystrokes";
FontFamily = new FontFamily("Courier New");
Grid grid = new Grid();
Content = grid;
// Make one row "auto" and the other fill the remaining space.
RowDefinition rowdef = new RowDefinition();
rowdef.Height = GridLength.Auto;
grid.RowDefinitions.Add(rowdef);
grid.RowDefinitions.Add(new RowDefinition());
// Display header text.
TextBlock textHeader = new TextBlock();
textHeader.FontWeight = FontWeights.Bold;
textHeader.Text = strHeader;
grid.Children.Add(textHeader);
// Create StackPanel as child of ScrollViewer for displaying events.
scroll = new ScrollViewer();
grid.Children.Add(scroll);
Grid.SetRow(scroll, 1);
stack = new StackPanel();
scroll.Content = stack;
}
示例2: FillMasterGrid
public void FillMasterGrid(IEnumerable<Grid> lyricGrids, Grid masterGrid)
{
// Create the Grid
masterGrid.Width = 510; //TODO: Auto width
masterGrid.HorizontalAlignment = HorizontalAlignment.Left;
masterGrid.VerticalAlignment = VerticalAlignment.Top;
masterGrid.ShowGridLines = false;
masterGrid.Background = new SolidColorBrush(Colors.LightSteelBlue);
//add one column
var column = new ColumnDefinition { Width = GridLength.Auto };
masterGrid.ColumnDefinitions.Add(column);
// Create Rows
var row = new RowDefinition { Height = GridLength.Auto };
masterGrid.RowDefinitions.Add(row);
// fill rows with lyric grids
var lGrids = lyricGrids.ToList();
for (var i = 0; i < lGrids.Count(); i++)
{
var lyricGrid = lGrids[i];
Grid.SetRow(lyricGrid, i);
Grid.SetColumn(lyricGrid, 0);
masterGrid.Children.Add(lyricGrid);
}
}
示例3: GenereateFields
public static void GenereateFields()
{
// Get the Grid from the MainWindow
Grid AuthenticationGrid = ((MainWindow)System.Windows.Application.Current.MainWindow).AuthenticationGrid;
// Build a list of Digest Auth Fields
List<string> fields = new List<string>();
fields.Add("Username");
fields.Add("Password");
for (int i = 0; i < fields.Count; i++)
{
// Add a row to the AuthGrid
RowDefinition rowDefinition = new RowDefinition();
rowDefinition.Height = GridLength.Auto;
AuthenticationGrid.RowDefinitions.Add(rowDefinition);
// Add a Label
Label label = new Label();
label.SetValue(Grid.RowProperty, i + 1);
label.SetValue(Grid.ColumnProperty, 0);
label.Name = "AuthenticationKey" + i;
label.Content = fields[i] + ":";
AuthenticationGrid.Children.Add(label);
// Add a textbox
TextBox textBox = new TextBox();
textBox.SetValue(Grid.RowProperty, i + 1);
textBox.SetValue(Grid.ColumnProperty, 1);
textBox.Name = "AuthenticationValue" + i;
AuthenticationGrid.Children.Add(textBox);
}
}
示例4: createControls
private void createControls()
{
int index = 0;
foreach (VKMessage message in messageList)
{
IList<VKUser> userList = UserDAO.getUsersByMessage(message);
RowDefinition rowDefinition = new RowDefinition();
rowDefinition.Height = GridLength.Auto;
ContentPanel.RowDefinitions.Add(rowDefinition);
//int index = 0;
/*
Image avatar = new Image();
Uri uri = new Uri("VKClient/Assets/Photo_Placeholder.png", UriKind.Relative);
StreamResourceInfo resourceInfo = Application.GetResourceStream(uri);
BitmapImage bmp = new BitmapImage();
bmp.SetSource(resourceInfo.Stream);
avatar.Source = bmp;
*/
MessagePreviewControl messControl = new MessagePreviewControl
{
//Avatar = avatar,
Text = message.Body,
// TODO: implement showing of multiple users (беседа)
FullName = userList[0].LastName,
Time = message.Date.ToString()
};
ContentPanel.Children.Add(messControl);
Grid.SetRow(messControl, index);
index++;
}
}
示例5: Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;
cache = cache ?? new Dictionary<string, Grid>();
Item item = value as Item;
string key = getKey(item);
if (cache.ContainsKey(key))
return cache[key];
int inventoryId = int.Parse(item.InventoryId.Replace("Stash", "")) - 1;
Grid g = new Grid();
StashControl control = new StashControl() { TabNumber = inventoryId };
Tab tab = ApplicationState.Stash[ApplicationState.CurrentLeague].Tabs.Find(t => t.i == inventoryId);
Image tabImage = getImage(tab, true);
control.SetValue(StashControl.FilterProperty, new List<IFilter>() { new ItemFilter(item) });
control.ForceUpdate();
RowDefinition imageRow = new RowDefinition();
imageRow.Height = new GridLength(26);
g.RowDefinitions.Add(imageRow);
g.RowDefinitions.Add(new RowDefinition());
tabImage.SetValue(Grid.RowProperty, 0);
control.SetValue(Grid.RowProperty, 1);
g.Children.Add(tabImage);
g.Children.Add(control);
cache.Add(key, g);
return g;
}
示例6: PageContent
public PageContent()
{
Brush brush = new SolidColorBrush(Colors.DarkGray);
brush.Opacity = 0.80;
this.Background = brush;
Border frameBorder = new Border();
frameBorder.BorderBrush = Brushes.Gray;
frameBorder.BorderThickness = new Thickness(2);
Grid panelMain = new Grid();
RowDefinition rowDefTop = new RowDefinition();
rowDefTop.Height = new GridLength(90, GridUnitType.Star);
panelMain.RowDefinitions.Add(rowDefTop);
RowDefinition rowDefBottom = new RowDefinition();
rowDefBottom.Height = new GridLength(10, GridUnitType.Star);
panelMain.RowDefinitions.Add(rowDefBottom);
panelContent = new StackPanel();
panelContent.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
panelContent.Margin = new Thickness(10, 10, 10, 10);
Grid.SetRow(panelContent, 0);
panelMain.Children.Add(panelContent);
frameBorder.Child = panelMain;
this.Content = frameBorder;
}
示例7: VerticalLayout
/**
* The constructor
*/
public VerticalLayout()
{
mGrid = new System.Windows.Controls.Grid();
mColDef = new ColumnDefinition();
mSpacerUp = new RowDefinition();
mSpacerDown = new RowDefinition();
mSpacerRight = new ColumnDefinition();
mSpacerLeft = new ColumnDefinition();
mColDef.Width = new System.Windows.GridLength(1, System.Windows.GridUnitType.Star);
mSpacerUp.Height = new System.Windows.GridLength(0);
mSpacerDown.Height = new System.Windows.GridLength(0);
mSpacerRight.Width = new System.Windows.GridLength(0);
mSpacerLeft.Width = new System.Windows.GridLength(0);
mGrid.RowDefinitions.Add(mSpacerUp);
mGrid.RowDefinitions.Add(mSpacerDown);
mGrid.ColumnDefinitions.Add(mSpacerLeft);
mGrid.ColumnDefinitions.Add(mColDef);
mGrid.ColumnDefinitions.Add(mSpacerRight);
this.fillSpaceVerticalyEnabled = false;
this.fillSpaceHorizontalyEnabled = false;
mView = mGrid;
#if DEBUG
mGrid.ShowGridLines = true;
#endif
}
示例8: BindGridStructure
public void BindGridStructure()
{
RowDefinitions.Clear();
ColumnDefinitions.Clear();
Observable.Range(0, Rows)
.Subscribe(c =>
{
var rowDef = new RowDefinition();
if(CellHeight > 0)
{
rowDef.Height = new GridLength(CellHeight);
}
RowDefinitions.Add(rowDef);
});
Observable.Range(0, Columns)
.Subscribe(c =>
{
var def = new ColumnDefinition();
if(CellWidth > 0)
{
def.Width = new GridLength(CellWidth);
}
ColumnDefinitions.Add(def);
});
}
示例9: AddItem
private void AddItem(string imgPath)
{
Grid grid = new Grid();
grid.Style = gridStyle;
RowDefinition row1 = new RowDefinition();
row1.Height = GridLength.Auto;
RowDefinition row2 = new RowDefinition();
row2.Height = GridLength.Auto;
grid.RowDefinitions.Add(row1);
grid.RowDefinitions.Add(row2);
Image img = new Image();
img.Style = imageStyle;
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(imgPath);
bitmap.EndInit();
img.Source = bitmap;
string imageName = Path.GetFileName(imgPath).Substring(0, Path.GetFileName(imgPath).IndexOf("."));
img.ToolTip = imageName;
TextBlock tbk = new TextBlock();
tbk.Style = tbkStyle;
tbk.Text = imageName;
grid.Children.Add(img);
grid.Children.Add(tbk);
Grid.SetColumn(img, 0);
Grid.SetColumn(tbk, 0);
Grid.SetRow(img, 0);
Grid.SetRow(tbk, 1);
this.Items.Add(grid);
}
示例10: SetPreviewType
public void SetPreviewType(string val) {
gpl.Children.Clear();
gpl.RowDefinitions.Clear();
int row = 0;
foreach (ColumnMetaInfo bmf in bmRequiredFields)
{
RowDefinition rr = new RowDefinition();
rr.Height = new GridLength(25);
gpl.RowDefinitions.Add(rr);
SolidColorBrush scb = Brushes.Red;
if (bmf.hasFK) {
scb = Brushes.Gold;
}
CreateDynamicLabel(row,bmf.columnName, scb);
row++;
}
foreach (ColumnMetaInfo bmf in bmOptionalFields)
{
RowDefinition rr = new RowDefinition();
rr.Height = new GridLength(25);
gpl.RowDefinitions.Add(rr);
SolidColorBrush scb = Brushes.Red;
if (bmf.hasFK)
{
scb = Brushes.Gold;
CreateDynamicLabel(row, bmf.columnName, Brushes.Orange);
row++;
}
}
}
示例11: CreateGrid
/// <summary>
/// Kreiranje "tablice" ocjena na temelju proslijeđene string matrice.
/// </summary>
/// <param name="matrix"></param>
public void CreateGrid(String[,] matrix)
{
contentGrid.ColumnDefinitions.Clear();
contentGrid.RowDefinitions.Clear();
contentGrid.Children.Clear();
int height = 50;
while (height * (matrix.GetLength(0) + 1) > contentGrid.Height)
height--;
for (int i = 0; i < matrix.GetLength(0); i++) {
RowDefinition rowDef = new RowDefinition();
rowDef.Height = new GridLength(height);
contentGrid.RowDefinitions.Add(rowDef);
for (int j = 0; j < matrix.GetLength(1); j++) {
ColumnDefinition columnDef = new ColumnDefinition();
columnDef.Width = new GridLength(j == 0 ? 150 : (contentGrid.Width / (matrix.GetLength(1) + 2)));
contentGrid.ColumnDefinitions.Add(columnDef);
Label label = new Label();
if (i == 0 || j == 0)
label.FontWeight = FontWeights.Bold;
Grid.SetRow(label, i);
Grid.SetColumn(label, j);
label.Content = matrix[i, j];
contentGrid.Children.Add(label);
}//for 2
}
}
示例12: GetUIElement
public override UIElement GetUIElement()
{
var grid = new Grid();
ColumnDefinition columnDefinition1 = new ColumnDefinition();
ColumnDefinition columnDefinition2 = new ColumnDefinition();
columnDefinition1.Width = new GridLength(1, GridUnitType.Auto);
columnDefinition2.Width = new GridLength(1, GridUnitType.Star);
grid.ColumnDefinitions.Add(columnDefinition1);
grid.ColumnDefinitions.Add(columnDefinition2);
foreach (var gt in ApplicationData.Instance.GeocacheContainers)
{
RowDefinition rowDefinition = new RowDefinition();
rowDefinition.Height = GridLength.Auto;
grid.RowDefinitions.Add(rowDefinition);
var cb = new CheckBox();
cb.IsChecked = Values.Contains(gt.Name);
grid.Children.Add(cb);
Grid.SetRow(cb, grid.RowDefinitions.Count - 1);
Grid.SetColumn(cb, 0);
var txt = new TextBlock();
txt.Text = gt.Name;
grid.Children.Add(txt);
Grid.SetRow(txt, grid.RowDefinitions.Count - 1);
Grid.SetColumn(txt, 1);
}
return grid;
}
开发者ID:GlobalcachingEU,项目名称:GSAKWrapper,代码行数:33,代码来源:ActionImplementationGeocacheContainerMultiple.cs
示例13: AppendItemToGrid
/// <summary>
/// Append an item to it's parent and update the layout
/// </summary>
/// <param name="grid"></param>
/// <param name="item"></param>
public void AppendItemToGrid(Grid grid, TreeGridItem item)
{
RowDefinition row = new RowDefinition();
grid.RowDefinitions.Add(row);
grid.Children.Add(item);
Grid.SetColumn(item, 0);
Grid.SetRow(item, grid.RowDefinitions.Count - 1);
item.HorizontalAlignment = HorizontalAlignment.Left;
item.VerticalAlignment = VerticalAlignment.Top;
TreeGridItem parent = GetDisplay(item.Model.Parent);
if (parent != null)
{
Brush stroke = new SolidColorBrush(Color.FromArgb((byte)100, (byte)0, (byte)0, (byte)0.5));
TreeGridLine line = new TreeGridLine()
{
Line1 = new Line() { Stroke = stroke, StrokeThickness = 2 },
Line2 = new Line() { Stroke = stroke, StrokeThickness = 2 },
Line3 = new Line() { Stroke = stroke, StrokeThickness = 2 },
Start = parent,
End = item
};
UnderlayCanvas.Children.Add(line.Line1);
UnderlayCanvas.Children.Add(line.Line2);
UnderlayCanvas.Children.Add(line.Line3);
_lines.Add(line);
}
UpdateDimensions(item, true);
row.Height = new GridLength(item.Height);
}
示例14: Window_Loaded
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Grid grid = new Grid();
TextBlock barGraph = new TextBlock();
barGraph.FontSize = 50;
TextBox barString = new TextBox();
barString.HorizontalAlignment = HorizontalAlignment.Center;
barString.VerticalAlignment = VerticalAlignment.Center;
barString.FontSize = 50;
barString.TextChanged += new TextChangedEventHandler(TextBox_TextChanged);
barString.Text = "2";
barString.BorderBrush = Brushes.Transparent;
barString.Background = Brushes.Transparent;
RowDefinition row1 = new RowDefinition();
row1.Height = GridLength.Auto;
RowDefinition row2 = new RowDefinition();
row2.Height = GridLength.Auto;
grid.RowDefinitions.Add(row1);
grid.RowDefinitions.Add(row2);
grid.Children.Add(barGraph);
grid.Children.Add(barString);
Grid.SetColumn(barGraph, 0);
Grid.SetRow(barGraph, 0);
Grid.SetColumn(barString, 0);
Grid.SetRow(barString, 1);
mainGrid.Children.Add(grid);
}
示例15: BoardView
public BoardView(Board myBoard)
{
InitializeComponent();
this.myBoard = myBoard;
LoadPictures();
for (int i = 0; i < nCols; i++)
{
ColumnDefinition col = new ColumnDefinition();
col.Width = new GridLength(cellSize);
FieldsGrid.ColumnDefinitions.Add(col);
}
for (int i = 0; i < nRows; i++)
{
RowDefinition row = new RowDefinition();
row.Height = new GridLength(cellSize);
FieldsGrid.RowDefinitions.Add(row);
}
UpdateView();
Dice = new Label();
Dice.FontSize = 35;
Dice.Height = 50;
Dice.Width = 50;
Dice.HorizontalAlignment = HorizontalAlignment.Center;
Dice.VerticalAlignment = VerticalAlignment.Center;
Grid.SetColumn(Dice, 5);
Grid.SetRow(Dice, 5);
FieldsGrid.Children.Add(Dice);
}