本文整理汇总了C#中System.Windows.Controls.DockPanel类的典型用法代码示例。如果您正苦于以下问题:C# DockPanel类的具体用法?C# DockPanel怎么用?C# DockPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DockPanel类属于System.Windows.Controls命名空间,在下文中一共展示了DockPanel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PageHeader
public PageHeader()
{
Brush brush = new SolidColorBrush(Colors.DarkGray);
brush.Opacity = 0.60;
this.Background = brush;
Border frameBorder = new Border();
frameBorder.BorderBrush = Brushes.Gray;
frameBorder.BorderThickness = new Thickness(2);
DockPanel panelMain = new DockPanel();
panelMain.Margin = new Thickness(5, 5, 5, 5);
panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
txtText = new TextBlock();
txtText.FontSize = 32;
txtText.Margin = new Thickness(5, 0, 0, 0);
txtText.SetResourceReference(TextBlock.ForegroundProperty, "HeaderTextColor");
txtText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
panelMain.Children.Add(txtText);
frameBorder.Child = panelMain;
this.Content = frameBorder;
}
示例2: WindowControl
// Vehicles Dock Panel
public WindowControl(Window MainWindow,
List<BitmapImage> Images, Image IViewer, // Image viewer
DockPanel DockPanelStates, // States Dock Panel
DockPanel DockPanelVehicles)
{
InitializeComponent();
// Initialize
this.mainWindow = MainWindow;
this.images = Images;
this.iViewer = IViewer;
this.dockPanelStates = DockPanelStates;
this.dockPanelVehicles = DockPanelVehicles;
this.slide = 0;
this.image = 0;
// Set up the intial image viewer
this.iViewer.Source = this.images[this.image]; // 0.jpg
this.iViewer.Stretch = Stretch.Fill;
// Configure the initial main window content
this.mainWindow.Content = this.iViewer;
// Update info
this.LabelInfo.Content = "Viewing slide: " + this.slide.ToString();
this.LabelNext.Content = "Next slide: " + (this.slide + 1).ToString();
}
示例3: CreateColourPickerDockPanel
private DockPanel CreateColourPickerDockPanel()
{
DockPanel dockPanel = new DockPanel()
{
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(4),
};
dockPanel.Children.Add(new ColorCanvas() { SelectedColor = SelectedColour, Margin = new Thickness(4) });
dockPanel.Children.Add(new Button()
{
IsDefault = true,
Padding = new Thickness(16, 4, 16, 4),
Margin = new Thickness(4),
Content = "Select Color",
HorizontalAlignment = HorizontalAlignment.Center
});
dockPanel.Children.OfType<ColorCanvas>().First().SetValue(DockPanel.DockProperty, Dock.Top);
dockPanel.Children.OfType<Button>().First().Click += new RoutedEventHandler(ColourPickerDialogOkay_Click);
return dockPanel;
}
示例4: FormatRichText
public FormatRichText()
{
Title = "Format Rich Text";
// Create DockPanel as content of window.
DockPanel dock = new DockPanel();
Content = dock;
// Create ToolBarTray docked at top of client area.
ToolBarTray tray = new ToolBarTray();
dock.Children.Add(tray);
DockPanel.SetDock(tray, Dock.Top);
// Create RichTextBox.
txtbox = new RichTextBox();
txtbox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
// Call methods in other files.
AddFileToolBar(tray, 0, 0);
AddEditToolBar(tray, 1, 0);
AddCharToolBar(tray, 2, 0);
AddParaToolBar(tray, 2, 1);
AddStatusBar(dock);
// Fill rest of client area with RichTextBox and give it focus.
dock.Children.Add(txtbox);
txtbox.Focus();
}
示例5: CreatePanels
void CreatePanels()
{
int nbPanels = _panel.MaxColumnByRowProperty * _panel.MaxRowProperty;
int column = 0;
int row = 0;
bool rightDirection = true;
for( int i = 0; i < nbPanels; i++ )
{
DockPanel dp = new DockPanel();
dp.DataContext = _panel.Panels[i];
dp.SetBinding( DockPanel.BackgroundProperty, new Binding( "IsActive" ) { Converter = new BooleanToColor() } );
Grid.SetColumn( dp, column );
Grid.SetRow( dp, row );
SplitGrid.Children.Add( dp );
if( rightDirection ) column++;
else column--;
if( column >= _panel.MaxColumnByRowProperty && rightDirection )
{
row++;
column--;
rightDirection = false;
}
else if( column == -1 && !rightDirection )
{
row++;
rightDirection = true;
column++;
}
_dockPanels.Add( dp );
}
}
示例6: SelectFolderPopupCenter
public SelectFolderPopupCenter()
{
sf.FolderChanged += sf_FolderChanged;
StackPanel spWrapper = new StackPanel();
spWrapper.Orientation = Orientation.Vertical;
spWrapper.Children.Add(sf);
DockPanel dp = new DockPanel();
dp.LastChildFill = false;
Button btnCancel = new Button();
btnCancel.Content = "Cancel";
btnCancel.Click += btnCancel_Click;
btnCancel.Margin = new Thickness(5);
DockPanel.SetDock(btnCancel, Dock.Right);
btnOk = new Button();
btnOk.IsEnabled = false;
btnOk.Content = "OK";
btnOk.Click += btnOk_Click;
btnOk.Margin = new Thickness(5);
DockPanel.SetDock(btnOk, Dock.Right);
dp.Children.Add(btnCancel);
dp.Children.Add(btnOk);
spWrapper.Children.Add(dp);
this.Content = spWrapper;
}
示例7: GetProperyField
public override FrameworkElement GetProperyField()
{
var pan = new DockPanel();
t = (new TextBox());
try
{
t.Text = GetVaueAsType<ImageSource>().ToString();
}
catch { }//Null value
t.TextChanged += delegate(object sender, TextChangedEventArgs e) { SetString(t.Text); };
var btn = new Button();
btn.Content = "...";
btn.Click += delegate
{
var fpd = new System.Windows.Forms.OpenFileDialog();
fpd.Filter = "Images|*.jpg;*.jpeg;*.png;*.gif;*.tif;*.bmp";
if (fpd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
t.Text = fpd.FileName;
}
};
DockPanel.SetDock(btn, Dock.Right);
pan.Children.Add(btn);
pan.Children.Add(t);
return pan;
}
示例8: BuildPropertyGrid
void BuildPropertyGrid()
{
dockPanel = new DockPanel {LastChildFill = true, Width = 200, Height = 400,};
wpfPropertyGrid = new WpfPropertyGrid{SelectedObject = AdornedElement, HelpVisible = true};
dockPanel.Children.Add(wpfPropertyGrid);
visualChildren.Add(dockPanel);
}
示例9: KoncowyTest
public KoncowyTest(List<string[]> slowa)
{
InitializeComponent();
labels = new Label[15];
textboxes = new TextBox[15];
this.slowa = slowa;
for (int i = 0; i < 15; i++)
{
labels[i] = new Label();
textboxes[i] = new TextBox();
labels[i].Content = slowa[i][0];
labels[i].Margin = new Thickness(0,5,0,5);
textboxes[i].Margin = new Thickness(0, 5, 0, 5);
textboxes[i].MinWidth = 50;
DockPanel dock = new DockPanel();
dock.MinWidth = 200;
var sep = new Separator();
sep.MinWidth = 50;
sep.Visibility = Visibility.Hidden;
;
dock.Children.Add(labels[i]);
dock.Children.Add(sep);
dock.Children.Add(textboxes[i]);
StackPanel.Children.Add(dock);
}
}
示例10: DockAroundTheBlock
public DockAroundTheBlock()
{
Title = "Dock Around the Block";
// 1. �г� ���� �� �ʱ�ȭ
DockPanel dock = new DockPanel();
Content = dock;
// 2. ���ϴ� �ڽ� ��ü(�̹���, ��Ʈ��, �г�..)
for (int i = 0; i < 17; i++)
{
Button btn = new Button();
btn.Content = "Button No. " + (i + 1);
//-------------------------------------------------
dock.Children.Add(btn);
btn.SetValue(DockPanel.DockProperty, (Dock)(i % 4));
DockPanel.SetDock(btn, (Dock)(i % 4));
//-------------------------------------------------
}
// dock.LastChildFill = true;
dock.LastChildFill = false;
}
示例11: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_ui_txtTitle = (TextBlock)GetTemplateChild("_ui_txtTitle");
if (null != (_ui_btnOpenClose = (Button)GetTemplateChild("_ui_btnOpenClose")))
_ui_btnOpenClose.Click += new RoutedEventHandler(_ui_btnOpenClose_Click);
_ui_rectOpenClose = (Rectangle)GetTemplateChild("_ui_rectOpenClose");
_ui_brdContent = (Border)GetTemplateChild("_ui_brdContent");
_ui_cntContent = (ContentControl)GetTemplateChild("_ui_cntContent");
if (null != (_ui_dpHeader = (DockPanel)GetTemplateChild("_ui_dpHeader")))
_ui_dpHeader.MouseLeftButtonDown += new MouseButtonEventHandler(_ui_dpHeader_MouseLeftButtonDown);
// Image cImg = new Image();
ImageBrush cIB = new ImageBrush();
cIB.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri("/controls.sl;component/Images/rp_open.png", UriKind.Relative));
cIB.Stretch = Stretch.None;
_cOpenSymbol = cIB; // = cImg;
cIB = new ImageBrush();
cIB.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri("/controls.sl;component/Images/rp_close.png", UriKind.Relative));
cIB.Stretch = Stretch.None;
_cCloseSymbol = cIB; //= cImg;
if(Title.IsNullOrEmpty())
Title = g.Common.sName;
ProcessTitle();
ProcessIsOpen();
}
示例12: MainWindow
public MainWindow ()
{
Title = "Mono Windows Presentation Foundation utility";
MenuItem color_finder_menu = new MenuItem ();
color_finder_menu.Header = "_Color finder";
color_finder_menu.Click += delegate (object sender, RoutedEventArgs e)
{
new ColorFinder.ColorFinderWindow ().Show ();
};
MenuItem visual_structure_viewer_menu = new MenuItem ();
visual_structure_viewer_menu.Header = "_Visual structure viewer";
visual_structure_viewer_menu.Click += delegate (object sender, RoutedEventArgs e)
{
new VisualStructureViewer.VisualStructureViewerWindow ().Show ();
};
MenuItem utilities_menu = new MenuItem ();
utilities_menu.Header = "_Utilities";
utilities_menu.Items.Add (color_finder_menu);
utilities_menu.Items.Add (visual_structure_viewer_menu);
Menu menu = new Menu ();
menu.Items.Add (utilities_menu);
DockPanel contents = new DockPanel ();
contents.LastChildFill = false;
DockPanel.SetDock (menu, Dock.Top);
contents.Children.Add (menu);
Content = contents;
}
示例13: HideAllPanelsExceptOf
private void HideAllPanelsExceptOf(DockPanel dockPanel)
{
UIElementCollection children = ControlPanel.Children;
int index = children.IndexOf(dockPanel);
for (int i = 0; i < children.Count; ++i)
if (i != index) children[i].Visibility = Visibility.Collapsed;
}
示例14: Add_Click
private void Add_Click(object sender, RoutedEventArgs e)
{
DockPanel dp = new DockPanel();
dp.Width = 200;
dp.Height = 23;
dp.HorizontalAlignment = HorizontalAlignment.Left;
dp.VerticalAlignment = VerticalAlignment.Top;
Button X = new Button();
X.Height = 23;
X.Width = 30;
X.Content = "X";
X.VerticalAlignment = VerticalAlignment.Top;
X.HorizontalAlignment = HorizontalAlignment.Left;
X.Click += X_Click;
TextBox tb = new TextBox();
tb.Height = 23;
tb.Width = 170;
tb.HorizontalAlignment = HorizontalAlignment.Left;
tb.VerticalAlignment = VerticalAlignment.Top;
tb.FontFamily = new FontFamily("Times New Roman");
tb.BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF707070"));
dp.Children.Add(tb);
dp.Children.Add(X);
SearchGrid.Children.Add(dp);
}
示例15: When_adding_a_view_to_the_layout_should_add_view_to_panel_children_collection
public void When_adding_a_view_to_the_layout_should_add_view_to_panel_children_collection()
{
Panel element = new DockPanel();
PanelDecoratingLayout layout = new PanelDecoratingLayout(element);
layout.AddView(new DemoView());
Assert.AreEqual(1, element.Children.Count);
}