本文整理汇总了C#中System.Windows.Controls.StackPanel类的典型用法代码示例。如果您正苦于以下问题:C# StackPanel类的具体用法?C# StackPanel怎么用?C# StackPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StackPanel类属于System.Windows.Controls命名空间,在下文中一共展示了StackPanel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:28,代码来源:ExamineKeystrokes.cs
示例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;
}
开发者ID:JPGoldenPheasant,项目名称:MyRepository,代码行数:25,代码来源:Window1.g.i.cs
示例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");
}
开发者ID:shuoshen2014,项目名称:windowwalker,代码行数:35,代码来源:MainWindow.xaml.cs
示例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;
}
开发者ID:GlobalcachingEU,项目名称:GSAKWrapper,代码行数:30,代码来源:ActionLocatedInArea.cs
示例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;
}
开发者ID:kb10uy,项目名称:Kbtter,代码行数:25,代码来源:ExListWindow.xaml.cs
示例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);
}
开发者ID:MikeOrtman,项目名称:MultitouchExplorer,代码行数:25,代码来源:ContentCardImage.cs
示例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;
}
开发者ID:kubaszostak,项目名称:KSz.Shared,代码行数:27,代码来源:ImageButton.cs
示例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;
}
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:61,代码来源:PopUpTerminal.xaml.cs
示例9: VerUltimosCommits
public VerUltimosCommits(logicaGIT _pro, StackPanel _vparent)
{
InitializeComponent();
Proyecto = _pro;
vparent = _vparent;
this.Height = vparent.Height;
}
开发者ID:arkadoel,项目名称:CodigoGitCSharp,代码行数:7,代码来源:VerUltimosCommits.xaml.cs
示例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;
}
开发者ID:aceindy,项目名称:ArctiumTools,代码行数:34,代码来源:FileListItem.cs
示例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);
}
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:32,代码来源:PageAirport.xaml.cs
示例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();
}
开发者ID:boydlee,项目名称:CefSharp,代码行数:32,代码来源:MainWindow.xaml.cs
示例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;
}
}
开发者ID:zhengjin,项目名称:WindowDemo,代码行数:30,代码来源:MainWindow.xaml.cs
示例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;
}
开发者ID:bashlykevich,项目名称:MythologyWP,代码行数:31,代码来源:Helper.cs
示例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;
}
开发者ID:forki,项目名称:AskMe,代码行数:7,代码来源:SettingsPage.xaml.cs
示例16: SimpleUIBoundToCustomer
public SimpleUIBoundToCustomer()
{
var stack = new StackPanel();
Content = stack;
var textBlock = new TextBlock();
textBlock.SetBinding(TextBlock.TextProperty, new Binding("FirstName"));
stack.Children.Add(textBlock);
textBlock = new TextBlock();
textBlock.SetBinding(TextBlock.TextProperty, new Binding("LstName")); //purposefully misspelled
stack.Children.Add(textBlock);
textBlock = new TextBlock();
textBlock.SetBinding(TextBlock.TextProperty, new Binding()); //context
stack.Children.Add(textBlock);
var checkbox = new CheckBox();
checkbox.SetBinding(CheckBox.IsCheckedProperty, new Binding("asdfsdf")); //does not exist
stack.Children.Add(checkbox);
var tooltip = new ToolTip();
tooltip.SetBinding(System.Windows.Controls.ToolTip.ContentProperty, new Binding("asdfasdasdf")); // does not exist
stack.ToolTip = tooltip;
var childUserControl = new SimpleUIBoundToCustomerByAttachedPorperty();
stack.Children.Add(childUserControl);
}
开发者ID:ssethi,项目名称:TestFrameworks,代码行数:28,代码来源:SimpleUIBoundToCustomer.cs
示例17: FillMessages
private void FillMessages()
{
var messages = GetMessage();
var usernamePattern = "Username: {0}";
var messagePattern = "Message: {0}";
var datePattern = "Date: {0}";
foreach (var message in messages)
{
var stackPanel = new StackPanel();
var textBlockUsername = new TextBlock();
textBlockUsername.Text = string.Format(usernamePattern, message.User.Username);
textBlockUsername.TextWrapping = TextWrapping.Wrap;
textBlockUsername.FontWeight = FontWeights.Bold;
stackPanel.Children.Add(textBlockUsername);
var textBlockMessage = new TextBlock();
textBlockMessage.Text = string.Format(messagePattern, message.Text);
textBlockMessage.TextWrapping = TextWrapping.Wrap;
stackPanel.Children.Add(textBlockMessage);
var textBlockDate = new TextBlock();
textBlockDate.Text = string.Format(datePattern, message.Date);
textBlockDate.TextWrapping = TextWrapping.Wrap;
stackPanel.Children.Add(textBlockDate);
this.lbMessages.Items.Add(stackPanel);
}
lastMessageNumber = this.lbMessages.Items.Count;
this.lbMessages.SelectedIndex = this.lbMessages.Items.Count - 1;
this.lbMessages.ScrollIntoView(this.lbMessages.SelectedItem);
}
开发者ID:nikolay-radkov,项目名称:Telerik-Academy,代码行数:34,代码来源:ChatRoom.xaml.cs
示例18: SelectColorFromWheel
public SelectColorFromWheel()
{
Title = "Select Color from Wheel";
SizeToContent = SizeToContent.WidthAndHeight;
StackPanel stack = new StackPanel();
stack.Orientation = Orientation.Horizontal;
Content = stack;
Button btn = new Button();
btn.Content = "Do-nothing button\nto test tabbing";
btn.Margin = new Thickness(24);
btn.HorizontalAlignment = HorizontalAlignment.Center;
btn.VerticalAlignment = VerticalAlignment.Center;
stack.Children.Add(btn);
ColorWheel clrwheel = new ColorWheel();
clrwheel.Margin = new Thickness(24);
clrwheel.HorizontalAlignment = HorizontalAlignment.Center;
clrwheel.VerticalAlignment = VerticalAlignment.Center;
stack.Children.Add(clrwheel);
clrwheel.SetBinding(ColorWheel.SelectedValueProperty, "Background");
clrwheel.DataContext = this;
btn = new Button();
btn.Content = "Do-nothing button\nto test tabbing";
btn.Margin = new Thickness(24);
btn.HorizontalAlignment = HorizontalAlignment.Center;
btn.VerticalAlignment = VerticalAlignment.Center;
stack.Children.Add(btn);
}
开发者ID:JianchengZh,项目名称:kasicass,代码行数:31,代码来源:SelectColorFromWheel.cs
示例19: btnPrint_Click
private void btnPrint_Click(object sender, RoutedEventArgs e)
{
//MessageBox.Show("Chart has been sent for printing...");
popup = new Popup() { Name = "Popup" };
border = new Border() { Name = "Border" };
panel1 = new StackPanel() { Name = "Panel" };
textblock1 = new TextBlock() { Name = "Textblock" };
border.BorderBrush = new SolidColorBrush(Colors.DarkGray);
border.BorderThickness = new Thickness(3.0);
panel1.Background = new SolidColorBrush(Colors.LightGray);
textblock1.Text = "Chart has been sent for printing...";
textblock1.Margin = new Thickness(30.0);
panel1.Children.Add(textblock1);
Button button = new Button(){ Content = "OK", Width = 30, Height = 20, Margin = new Thickness(5.0)};
button.Click +=new RoutedEventHandler(button_Click);
panel1.Children.Add(button);
border.Child = panel1;
popup.Child = border;
popup.HorizontalOffset = 613;
popup.VerticalOffset = 375;
popup.IsOpen = true;
}
开发者ID:Bezideiko,项目名称:Telerik_QA_Academy,代码行数:25,代码来源:Zooming.xaml.cs
示例20: Show
public override void Show(System.Windows.Controls.ContentControl contentControl, object writer)
{
ScrollViewer scrollViewer = new ScrollViewer();
StackPanel stackPanel = new StackPanel();
stackPanel.Orientation = Orientation.Vertical;
scrollViewer.Content = stackPanel;
this.m_ImageStreamSource = new FileStream(this.FullFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
TiffBitmapDecoder tiffDecoder = new TiffBitmapDecoder(this.m_ImageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
try
{
for (int i = 0; i < tiffDecoder.Frames.Count; i++)
{
BitmapSource bitMapSource = tiffDecoder.Frames[i];
Image image = new Image();
image.Source = bitMapSource;
stackPanel.Children.Add(image);
}
contentControl.Content = scrollViewer;
}
catch
{
}
}
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:25,代码来源:TifDocument.cs
注:本文中的System.Windows.Controls.StackPanel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论