本文整理汇总了C#中System.Windows.Controls.Expander类的典型用法代码示例。如果您正苦于以下问题:C# Expander类的具体用法?C# Expander怎么用?C# Expander使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Expander类属于System.Windows.Controls命名空间,在下文中一共展示了Expander类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: build_gui
private void build_gui()
{
this.DataContext = camera;
StackPanel sp_x = this.build_lbltxt(" X: ", "Eye_x");
StackPanel sp_y = this.build_lbltxt(" Y: ", "Eye_y");
StackPanel sp_z = this.build_lbltxt(" Z: ", "Eye_z");
StackPanel row1 = build_row(" Eye : ", sp_x, sp_y, sp_z);
StackPanel look_x = this.build_lbltxt(" X: ", "Lookat_x");
StackPanel look_y = this.build_lbltxt(" Y: ", "Lookat_y");
StackPanel loop_z = this.build_lbltxt(" Z: ", "Lookat_z");
StackPanel row2 = build_row(" LookAt : ", look_x, look_y, loop_z);
StackPanel sp = new StackPanel();
sp.Children.Add(row1);
sp.Children.Add(row2);
// Distance
StackPanel dist = this.build_lbltxt(" Distance: ", "Distance");
sp.Children.Add(dist);
Expander expand = new Expander();
expand.Header = "Camera";
expand.Foreground = Brushes.White;
expand.Content = sp;
this.Content = expand;
}
示例2: PopulateDepartmentGrid
/// <summary>
/// gets all departments using DepartmentService
/// and buid a Expander control with header= department name and content= department description
/// for each expander create a new row in gridDepartaments
/// </summary>
private void PopulateDepartmentGrid()
{
_deptService = new DepartmentService();
List<Department> depts = _deptService.FindAll();
int i = 0;
if (depts != null)
{
foreach (var dept in depts)
{
Expander expander = new Expander();
expander.HorizontalAlignment = HorizontalAlignment.Stretch;
expander.Header = dept.Name;
StackPanel stackPanel = new StackPanel();
TextBlock txt = new TextBlock();
txt.Text = dept.Description + ", " + dept.Floor;
stackPanel.Children.Add(txt);
expander.Content = stackPanel;
gridDepartaments.RowDefinitions.Add(new RowDefinition());
gridDepartaments.RowDefinitions[i].Height = new GridLength(50);
Grid.SetRow(expander, i);
i++;
gridDepartaments.Children.Add(expander);
}
}
}
示例3: addHitView
public void addHitView(int jobNumber,HITView view)
{
StackPanel sp = new StackPanel();
sp.MouseUp += option1_click;
//sp.Background = Brushes.LightGray;
panels[jobNumber] = sp;
views.Add(sp, view);
jobs.Children.Add(sp);
Border border = new Border();
border.BorderThickness = new Thickness(2.0); border.Height = 1;
border.BorderBrush = Brushes.Gray;
sp.Cursor = Cursors.Hand;
jobs.Children.Add(border);
sp.Children.Add(view.stub);
view.stub.registerSidebar(this);
//sp.LayoutUpdated += child_updated;
Expander ex = new Expander();
//ex.Header = view.stub;
//ex.Content = view;
//jobs.Children.Add(ex);
}
示例4: build_gui
private void build_gui()
{
this.DataContext = options;
StackPanel threads = this.build_lbltxt(" Threads: ", "Threads");
StackPanel spp1 = this.build_lbltxt(" SPP: ", "Spp");
StackPanel pixel_size = this.build_lbltxt(" Pixel size: ", "PixelSize");
StackPanel asm = this.build_lblcb(" Asm: ", "Asm");
StackPanel spectral = this.build_lblcb(" Spectral: ", "Spectral");
StackPanel width = this.build_lbltxt(" Width: ", "Width");
StackPanel height = this.build_lbltxt(" Height: ", "Height");
StackPanel sp = new StackPanel();
sp.Children.Add(threads);
sp.Children.Add(spp1);
sp.Children.Add(pixel_size);
sp.Children.Add(asm);
sp.Children.Add(spectral);
sp.Children.Add(width);
sp.Children.Add(height);
Expander expander = new Expander();
expander.Header = "Options";
expander.Foreground = Brushes.White;
expander.Content = sp;
this.Content = expander;
}
示例5: CreateUITasklist
private Expander CreateUITasklist(TaskList list, Google.Apis.Tasks.v1.Data.Tasks tasks)
{
var expander = new Expander();
// Add a bold title.
expander.Header = list.Title;
expander.FontWeight = FontWeights.Bold;
// Add the taskItems (if applicable).
if (tasks.Items != null)
{
var container = new StackPanel();
foreach (CheckBox box in tasks.Items.Select(CreateUITask))
{
container.Children.Add(box);
}
expander.Content = container;
}
else
{
expander.Content = "There are no tasks in this list.";
}
return expander;
}
示例6: AddReply
private void AddReply(SPTopic reply)
{
string htmlReply = reply.Body;
Debug.WriteLine(htmlReply);
// increase the default font size
htmlReply = htmlReply.Replace(";font-size:12;", ";font-size:18;");
Debug.WriteLine(htmlReply);
RichTextEditor richTextEditor = new RichTextEditor(htmlReply, false);
// TODO: set font size from user settings
Label headerLabel = new Label();
headerLabel.Content = string.Format("{0} wrote {1}", reply.Author, reply.Created);
headerLabel.FontStyle = FontStyles.Italic;
headerLabel.FontSize = 12;
Expander replyExpander = new Expander();
replyExpander.Header = headerLabel;
replyExpander.Content = richTextEditor;
replyExpander.IsExpanded = expander.IsExpanded;
if (reply.LastModified > reply.LastViewed)
{
Label label = (Label)replyExpander.Header;
label.FontWeight = FontWeights.Bold;
}
repliesListView.Children.Add(replyExpander);
}
示例7: MakeExpander
void MakeExpander()
{
//Create containing stack panel and assign to Grid row/col
StackPanel sp = new StackPanel();
Grid.SetRow(sp, 0);
Grid.SetColumn(sp, 1);
sp.Background = Brushes.LightSalmon;
//Create column title
TextBlock colTitle = new TextBlock();
colTitle.Text = "EXPANDER CREATED FROM CODE";
colTitle.HorizontalAlignment= HorizontalAlignment.Center;
colTitle.Margin.Bottom.Equals(20);
sp.Children.Add(colTitle);
//Create Expander object
Expander exp = new Expander();
//Create Bullet Panel for Expander Header
BulletDecorator bp = new BulletDecorator();
Image i = new Image();
BitmapImage bi= new BitmapImage();
bi.UriSource = new Uri(@"pack://application:,,/images/icon.jpg");
i.Source = bi;
i.Width = 10;
bp.Bullet = i;
TextBlock tb = new TextBlock();
tb.Text = "My Expander";
tb.Margin = new Thickness(20,0,0,0);
bp.Child = tb;
exp.Header = bp;
//Create TextBlock with ScrollViewer for Expander Content
StackPanel spScroll = new StackPanel();
TextBlock tbc = new TextBlock();
tbc.Text =
"Lorem ipsum dolor sit amet, consectetur adipisicing elit," +
"sed do eiusmod tempor incididunt ut labore et dolore magna" +
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation" +
"ullamco laboris nisi ut aliquip ex ea commodo consequat." +
"Duis aute irure dolor in reprehenderit in voluptate velit" +
"esse cillum dolore eu fugiat nulla pariatur. Excepteur sint" +
"occaecat cupidatat non proident, sunt in culpa qui officia" +
"deserunt mollit anim id est laborum.";
tbc.TextWrapping = TextWrapping.Wrap;
spScroll.Children.Add(tbc);
ScrollViewer scr = new ScrollViewer();
scr.Content = spScroll;
scr.Height = 50;
exp.Content = scr;
exp.Width=200;
exp.HorizontalContentAlignment= HorizontalAlignment.Stretch;
//Insert Expander into the StackPanel and add it to the
//Grid
sp.Children.Add(exp);
myGrid.Children.Add(sp);
}
示例8: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.DownloadParameters = ((System.Windows.Controls.Expander)(target));
return;
}
this._contentLoaded = true;
}
示例9: SetFilter
public void SetFilter(TestCaseFilter filter)
{
RuleList.Items.Clear();
foreach (var group in filter)
{
TreeView ruleTree = new TreeView();
CheckBox selectAll = new CheckBox()
{
Content = "(Select All)",
IsChecked = group.IsSelected,
Focusable = false,
Tag = group
};
selectAll.Checked += (sender, arg) =>
{
if (group.IsSelected != true) group.IsSelected = true;
};
selectAll.Unchecked += (sender, arg) =>
{
if (group.IsSelected != false) group.IsSelected = false;
};
group.PropertyChanged += (sender, arg) =>
{
if (arg.PropertyName == "IsSelected")
{
selectAll.IsChecked = group.IsSelected;
}
};
ruleTree.Items.Add(selectAll);
AddItems(ruleTree.Items, group);
Expander expander = new Expander()
{
Header = group.Name,
Content = ruleTree,
IsExpanded = true
};
RuleList.Items.Add(expander);
ruleTree.KeyDown += (sender, arg) =>
{
if (arg.Key != Key.Space) return;
var tv = sender as TreeView;
if (tv == null) return;
ToggleTreeview(tv);
};
ruleTree.PreviewMouseWheel += ScrollViewer_PreviewMouseWheel;
ruleTree.MouseDoubleClick += (sender, arg) =>
{
if (arg.ChangedButton != MouseButton.Left) return;
var tv = sender as TreeView;
if (tv == null) return;
ToggleTreeview(tv);
};
}
}
示例10: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/gMVVM;component/Views/Common/ToolHeader.xaml", System.UriKind.Relative));
this.RootItem = ((System.Windows.Controls.UserControl)(this.FindName("RootItem")));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ToolLog = ((System.Windows.Controls.Expander)(this.FindName("ToolLog")));
}
示例11: ShyTabs
public ShyTabs()
{
Loaded += (s, e) =>
{
_expander = this.Find<Expander>("_expander");
_vacantSpace = this.Find<Border>(name: "_vacantSpace");
_vacantSpace.MouseDown += (t, f)
=> { _expander.Toggle(); };
};
}
示例12: ExpanderAutomationPeerTypeAndClass
public virtual void ExpanderAutomationPeerTypeAndClass()
{
Expander item = new Expander();
ExpanderAutomationPeer peer = null;
TestAsync(
item,
() => peer = FrameworkElementAutomationPeer.CreatePeerForElement(item) as ExpanderAutomationPeer,
() => Assert.AreEqual(AutomationControlType.Group, peer.GetAutomationControlType(), "Unexpected AutomationControlType!"),
() => Assert.AreEqual("Expander", peer.GetClassName(), "Unexpected ClassType!"));
}
示例13: InstanceDetailsDialogExtensions
public InstanceDetailsDialogExtensions(System.Windows.Controls.UserControl dialogControl, ListBox productVersionControl, ListBox productRevisionControl, Expander moreSettinsExpander, TextBox instanceName)
{
this.DialogControl = dialogControl;
this.ParentWindow = FindParentWindow(this.DialogControl.Parent);
this.ProductVersion = productVersionControl;
this.ProductRevision = productRevisionControl;
this.MoreSettingsExpander = moreSettinsExpander;
this.InstanceName = instanceName;
}
示例14: MessageBoxEvent
static void MessageBoxEvent(Expander expander)
{
expander.Expanded += delegate
{
MessageBox.Show("");
};
expander.Collapsed += delegate
{
MessageBox.Show("");
};
}
示例15: ExpanderBackend
public ExpanderBackend()
{
Widget = new SWC.Expander();
Widget.Expanded += delegate {
EventSink.OnPreferredSizeChanged();
};
Widget.Collapsed += delegate {
EventSink.OnPreferredSizeChanged();
};
}