随笔分类 - WPF
摘要:<TreeView> <TreeViewItem Header="Desktop"> <TreeViewItem Header="Computer"> </TreeViewItem> </TreeViewItem> <TreeViewItem Header="Recycle Bin"> </TreeViewItem> <TreeViewItem Header="Control Panel"> <TreeViewIt
阅读全文
摘要:横排 <Menu> <MenuItem Header="_File"> <MenuItem Header="_New。¡ê。¡ê。¡ê"></MenuItem> <MenuItem Header="_Open。¡ê。¡ê。¡ê"></MenuItem> <Separator /> <MenuItem Header="S
阅读全文
摘要:<ListBox Name="lsTest"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ContextMenu> <ContextMenu> <MenuItem Header="_File&qu
阅读全文
摘要:<ListView> <ListView.View> <GridView> <GridViewColumn Header="Date" /> <GridViewColumn Header="Day of Week"DisplayMemberBinding="{Binding DayOfWeek}" /> <GridViewColumn Header="Year"DisplayMemberBinding="{Binding Year}&quo
阅读全文
摘要:<TabControl> <TextBlock>Content for Tab 1.</TextBlock> <TextBlock>Content for Tab 2.</TextBlock> <TextBlock>Content for Tab 3.</TextBlock> </TabControl> TabControl 隐式地用它的TabItem类型包装每一个项。由于没有一个显式的TabItem,就没有办法产生相应的标签。 <TabControl> <TabItem Head
阅读全文
摘要:IsEditable:把 ComboBox变成一个文本框; IsReadOnly:决定文本框是否可以编辑; 只有 IsEditable为 true 时,IsReadOnly 才起作用。 <ComboBox> <!--Item #1--> <StackPanel Orientation="Horizontal" Margin="5"> <Image Source="/Pictures/1.jpg"></Image> <StackPanel Width="200&
阅读全文
摘要:SelectionMode Single Mulle Extended <ListBox Name="lsTest"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBoxItem>Item1</ListBoxItem> &
阅读全文
摘要:<Expander Header="Grammar"> <StackPanel> <CheckBox>Check grammar as you type</CheckBox> <CheckBox>Hide grammatical errors in this document</CheckBox> <CheckBox>Check grammar with spellling</CheckBox> </StackPanel> </Expander> Expa
阅读全文
摘要:<GroupBox> <GroupBox.Header> <Button>Select All</Button> </GroupBox.Header> <StackPanel> <CheckBox>Check</CheckBox> <CheckBox>Hide</CheckBox> <CheckBox>Display</CheckBox> </StackPanel> </GroupBox>
阅读全文
摘要:ToolTip for Button <Button> OK <Button.ToolTip> Clicking this will submit your request. </Button.ToolTip> </Button> ToolTip for CheckBox <CheckBox> CheckBox <CheckBox.ToolTip> <StackPanel> <Label FontWeight="Bold" Background="Blue" For
阅读全文
摘要:private void PrintVisialTree(int depth, DependencyObject obj) { System.Diagnostics.Debug.WriteLine(new string(' ', depth) + obj); for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { PrintVisialTree(depth + 1, VisualTreeHelper.GetChild(obj, i)); } } protected overr...
阅读全文
摘要:private void PrintLogicalTree(int depth, object obj) { System.Diagnostics.Debug.WriteLine(new string(' ', depth) + obj); if (!(obj is DependencyObject)) { return; } foreach (object child in LogicalTreeHelper.GetChildren(obj as DependencyObject)) { PrintLogicalTree(depth + 1, chil...
阅读全文
摘要:Window window = null; using (FileStream fs = new FileStream("MyWindow.xaml", FileMode.Open, FileAccess.Read)) { window = (Window)System.Windows.Markup.XamlReader.Load(fs); } System.Windows.Controls.Button btnOk = (System.Windows.Controls.Button)window.FindName("btnOk");
阅读全文
摘要:<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Button.Content> <Rectangle Height="40" Width="40" Fill="Black" /> </Button.Content> </Button> System.Windows.Controls.Button button = new System.Windows.C
阅读全文
摘要:<ListView Height="264" HorizontalAlignment="Left" Margin="28,84,0,0" Name="listView1" VerticalAlignment="Top" Width="526" > <ListView.View> <GridView x:Name="gridView1"> <GridViewColumn Header="UserId&quo
阅读全文

浙公网安备 33010602011771号