本文整理汇总了C#中System.Windows.Controls.StackPanel类的典型用法代码示例。如果您正苦于以下问题:C# StackPanel类的具体用法?C# StackPanel怎么用?C# StackPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StackPanel类属于System.Windows.Controls命名空间,在下文中一共展示了StackPanel类的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: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.StackPanel1 = ((System.Windows.Controls.StackPanel)(target));
return;
case 2:
#line 9 "..\..\Window1.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.ClickMeThough);
#line default
#line hidden
return;
case 3:
#line 12 "..\..\Window1.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.FlipStackPanel);
#line default
#line hidden
return;
}
this._contentLoaded = true;
}
示例3: SearchResultUpdateHandler
public void SearchResultUpdateHandler(object sender, WindowWalker.Components.Window.WindowListUpdateEventArgs e)
{
resultsListBox.Items.Clear();
var windows = WindowSearchController.Instance.SearchMatches.Where(x => x.Hwnd != this.handleToMainWindow);
foreach (var window in windows)
{
var tempStackPanel = new StackPanel();
tempStackPanel.Orientation = Orientation.Horizontal;
var image = new Image();
image.Source = window.WindowIcon;
image.Margin = new Thickness(0,0,5,0);
tempStackPanel.Children.Add(image);
var tempTextBlock = new TextBlockWindow();
tempTextBlock.Text = window.Title;
if (!window.ProcessName.ToUpper().Equals(string.Empty))
{
tempTextBlock.Text += " (" + window.ProcessName.ToUpper() + ")" ;
}
tempTextBlock.Window = window;
tempStackPanel.Children.Add(tempTextBlock);
image.Height = 15;
this.resultsListBox.Items.Add(tempStackPanel);
}
if (resultsListBox.Items.Count != 0)
{
resultsListBox.SelectedIndex = 0;
}
System.Diagnostics.Debug.Print("Search result updated in Main Window. There are now " + this.resultsListBox.Items.Count + " windows that match the search term");
}
示例4: GetUIElement
public override UIElement GetUIElement()
{
if (Values.Count == 0)
{
Values.Add(Shapefiles.AreaType.State.ToString());
}
if (Values.Count < 2)
{
Values.Add("");
}
if (AvailableAreas == null)
{
AvailableAreas = new ObservableCollection<string>();
}
StackPanel sp = new StackPanel();
var opts = Enum.GetNames(typeof(Shapefiles.AreaType)).ToList();
ComboBox cb = CreateComboBox(opts.ToArray(), Values[0]);
cb.IsEditable = false;
sp.Children.Add(cb);
var opts2 = new string[] { };
cb = CreateComboBox(opts2, Values[1]);
cb.DropDownOpened += cb_DropDownOpened;
sp.Children.Add(cb);
Binding binding = new Binding();
binding.Source = AvailableAreas; // view model?
BindingOperations.SetBinding(cb, ComboBox.ItemsSourceProperty, binding);
return sp;
}
示例5: CreateListPanel
public UIElement CreateListPanel(TwitterList list)
{
var s = new StackPanel();
var si = new StackPanel();
s.Orientation = Orientation.Horizontal;
Image img = new Image { Width = 36, Height = 36 };
BitmapImage bi = new BitmapImage(new Uri(list.User.ProfileImageUrlHttps));
img.Source = bi;
s.Children.Add(img);
var ti = new TextBlock { FontSize = 20 };
ti.Text = (list.Mode == "private" ? "*" : "") + list.Name;
ti.TextWrapping = TextWrapping.Wrap;
var de = new TextBlock { Foreground = Brushes.Gray };
de.Text = list.Description;
de.TextWrapping = TextWrapping.Wrap;
var cn = new TextBlock();
cn.Text = list.MemberCount.ToString() + "人が追加されています";
si.Children.Add(ti);
si.Children.Add(cn);
si.Children.Add(de);
s.Children.Add(si);
s.Tag = list;
return s;
}
示例6: ContentCardImage
public ContentCardImage(Canvas parent_canvas, Color highlight_color, ExplorerContentImage explorer_image)
: base(parent_canvas, highlight_color)
{
explorerImage = explorer_image;
StackPanel background = new StackPanel();
background.Orientation = Orientation.Vertical;
background.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
background.Margin = new Thickness(5);
Image image = explorerImage.getImage();
image.MaxWidth = 300;
image.MaxHeight = 400;
image.Margin = new Thickness(0, 0, 0, 5);
background.Children.Add(image);
Label caption = new Label();
caption.Content = explorerImage.getName();
caption.FontSize = 20;
caption.MaxWidth = 300;
caption.FontWeight = FontWeights.Bold;
background.Children.Add(caption);
setContent(background);
}
示例7: ImageButton
public ImageButton()
{
this.Padding = new Thickness(4, 1, 4, 1);
var sp = new StackPanel();
sp.Orientation = Orientation.Horizontal;
sp.Children.Add(image);
sp.Children.Add(textBlock);
image.Stretch = Stretch.None;
//image.VerticalAlignment = VerticalAlignment.Center;
//textBlock.VerticalAlignment = VerticalAlignment.Center;
textBlock.Margin = new Thickness(3, 0, 0, 0);
Content = sp;
toolTipHeaderBlock.FontWeight = FontWeights.Bold;
toolTipDescriptionBlock.TextWrapping = TextWrapping.Wrap;
toolTipDescriptionBlock.Margin = new Thickness(0, 3, 0, 0);
var ttSp = new StackPanel();
ttSp.Margin = new Thickness(4);
ttSp.Children.Add(toolTipHeaderBlock);
ttSp.Children.Add(toolTipDescriptionBlock);
toolTip.Content = ttSp;
toolTip.MaxWidth = 400;
//this.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
//this.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
}
示例8: PopUpTerminal
//for creating a new terminal
public PopUpTerminal(Airport airport)
{
this.Airport = airport;
InitializeComponent();
this.Uid = "1000";
this.Title = Translator.GetInstance().GetString("PopUpTerminal", this.Uid);
this.Width = 400;
this.Height = 200;
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
StackPanel mainPanel = new StackPanel();
mainPanel.Margin = new Thickness(10, 10, 10, 10);
ListBox lbTerminal = new ListBox();
lbTerminal.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
lbTerminal.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
mainPanel.Children.Add(lbTerminal);
// chs 28-01-12: added for name of terminal
txtName = new TextBox();
txtName.Background = Brushes.Transparent;
txtName.BorderBrush = Brushes.Black;
txtName.IsEnabled = this.Terminal == null;
txtName.Width = 100;
txtName.Text = this.Terminal == null ? "Terminal" : this.Terminal.Name;
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal","1007"),txtName));
// chs 11-09-11: added numericupdown for selecting number of gates
nudGates = new ucNumericUpDown();
nudGates.Height = 30;
nudGates.MaxValue = 50;
nudGates.ValueChanged+=new RoutedPropertyChangedEventHandler<decimal>(nudGates_ValueChanged);
nudGates.MinValue = 1;
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1001"), nudGates));
/*
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalPrice()))));
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(string.Format("{0:C}",this.Airport.getTerminalGatePrice()))));
*/
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1002"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalPrice()).ToString())));
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1003"), UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.getTerminalGatePrice()).ToString())));
txtDaysToCreate = UICreator.CreateTextBlock("0 days");
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1004"), txtDaysToCreate));
txtTotalPrice = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(0).ToString());//UICreator.CreateTextBlock(string.Format("{0:C}", 0));
lbTerminal.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpTerminal", "1005"), txtTotalPrice));
mainPanel.Children.Add(createButtonsPanel());
nudGates.Value = 1;
this.Content = mainPanel;
}
示例9: VerUltimosCommits
public VerUltimosCommits(logicaGIT _pro, StackPanel _vparent)
{
InitializeComponent();
Proyecto = _pro;
vparent = _vparent;
this.Height = vparent.Height;
}
示例10: FileListItem
public FileListItem(string captionText, string imagePath)
: base()
{
Margin = new Thickness(13);
var panel = new StackPanel();
var imageSource = new BitmapImage();
var image = new Image();
var caption = new TextBlock();
imageSource.BeginInit();
imageSource.UriSource = new Uri(imagePath, UriKind.Relative);
imageSource.EndInit();
image.VerticalAlignment = System.Windows.VerticalAlignment.Center;
image.Source = imageSource;
image.Height = 64;
image.Width = 64;
image.ToolTip = "Select & click on 'Table' for data view.";
caption.TextAlignment = TextAlignment.Center;
caption.TextWrapping = TextWrapping.Wrap;
caption.Text = captionText;
Caption = captionText;
if (caption.Text.Length <= 18)
caption.Text += "\n ";
panel.Children.Add(image);
panel.Children.Add(caption);
Child = panel;
}
示例11: PageAirport
public PageAirport(Airport airport)
{
InitializeComponent();
this.Uid = "1000";
this.Title = Translator.GetInstance().GetString("PageAirport", this.Uid);
this.Airport = airport;
StackPanel airportPanel = new StackPanel();
airportPanel.Margin = new Thickness(10, 0, 10, 0);
airportPanel.Children.Add(createQuickInfoPanel());
airportPanel.Children.Add(createPassengersPanel());
//airportPanel.Children.Add(createFlightsPanel());
//airportPanel.Children.Add(createArrivalsPanel());
//airportPanel.Children.Add(createDeparturesPanel());
StandardContentPanel panelContent = new StandardContentPanel();
panelContent.setContentPage(airportPanel, StandardContentPanel.ContentLocation.Left);
StackPanel panelSideMenu = new PanelAirport(this.Airport);
panelContent.setContentPage(panelSideMenu, StandardContentPanel.ContentLocation.Right);
base.setContent(panelContent);
base.setHeaderContent(this.Title + " - " + this.Airport.Profile.Name);
showPage(this);
}
示例12: runArbiraryJsMenuItem_Click
private void runArbiraryJsMenuItem_Click(object sender, RoutedEventArgs e)
{
var panel = new StackPanel()
{
Orientation = Orientation.Horizontal,
};
var text = new TextBox
{
Width = 320,
};
panel.Children.Add(text);
var button = new Button
{
Content = "Run",
};
button.Click += delegate
{
var result = browser.RunScript(text.Text);
Console.WriteLine("Result: {0}", result);
};
panel.Children.Add(button);
var dialog = new Window
{
Content = panel,
SizeToContent = SizeToContent.WidthAndHeight,
ResizeMode = ResizeMode.NoResize,
};
dialog.Show();
}
示例13: NavPaneButton_Click
protected void NavPaneButton_Click(object sender, RoutedEventArgs e)
{
string tabName = ((NavigationPaneButton)sender).Name.ToString();
bool flag = false;
if (this.tabControl.Items.Count > 0)
{
foreach (var mainItem in tabControl.Items)
{
if (((Control)mainItem).Name == tabName)
{
tabControl.SelectedItem = mainItem;
flag = true;
return;
}
}
}
if (!flag)
{
FabTabItem item = new FabTabItem();
item.Name = tabName;
item.Header = tabName;
item.TabClosing+=new RoutedEventHandler(item_TabClosing);
StackPanel s = new StackPanel();
item.Content = s;
s.Children.Add(new TextBlock() { Text = tabName });
tabControl.Items.Add(item);
tabControl.SelectedItem = item;
}
}
示例14: GenerateRecordString
public static StackPanel GenerateRecordString(int num, int points, string date, string nations)
{
StackPanel sp = new StackPanel();
sp.Orientation = System.Windows.Controls.Orientation.Horizontal;
TextBlock tb1 = new TextBlock();
tb1.Width = 40;
tb1.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
tb1.Text = "#" + num.ToString();
sp.Children.Add(tb1);
TextBlock tb2 = new TextBlock();
tb2.Width = 60;
tb2.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
tb2.Text = points.ToString();
sp.Children.Add(tb2);
TextBlock tb3 = new TextBlock();
tb3.Width = 200;
tb3.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
tb3.Text = date;
sp.Children.Add(tb3);
TextBlock tb4 = new TextBlock();
tb4.Width = 200;
tb4.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
tb4.Text = nations;
sp.Children.Add(tb4);
return sp;
}
示例15: CreatePanel
public Panel CreatePanel(string text)
{
var panel = new StackPanel {Orientation = Orientation.Horizontal};
panel.Children.Add(new TextBox {Text = "", Width = 30});
panel.Children.Add(new Label {Content = text});
return panel;
}