标签:
<Grid ShowGridLines="True"> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> ... </Grid>
<Grid ShowGridLines="True"> ... <Button Grid.Row="0" Grid.Column="0">Top Left</Button> <Button Grid.Row="0" Grid.Column="1">Middle Left</Button> <Button Grid.Row="1" Grid.Column="2">Bottom Right</Button> <Button Grid.Row="1" Grid.Column="1">Bottom Middle</Button> </Grid>
<ColumnDefinition Width="100"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> <RowDefinition Height="*"></RowDefinition> <RowDefinition Height="2*"></RowDefinition>
<Grid UseLayoutRounding="True">
<Button Grid.Row="0" Grid.Column="0" Grid.RowSpan="2">Span Button</Button> <Button Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2"> Span Button</Button>
<Grid ShowGridLines="True"> <Grid.RowDefinitions> <RowDefinition Height="*"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBox Margin="10" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"> This is a test.</TextBox> <Button Margin="10,10,2,10" Padding="3" Grid.Row="1" Grid.Column="1">OK</Button> <Button Margin="2,10,10,10" Padding="3" Grid.Row="1" Grid.Column="2">Cancel</Button> </Grid>
<Grid ShowGridLines="True"> <Grid.RowDefinitions> <RowDefinition Height="*"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> </Grid.RowDefinitions> <TextBox Margin="10" Grid.Row="0">This is a test.</TextBox> <StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal"> <Button Margin="10,10,2,10" Padding="3">OK</Button> <Button Margin="2,10,10,10" Padding="3">Cancel</Button> </StackPanel> </Grid>
<Window x:Class="WpfPanelExp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid IsManipulationEnabled="True"> <Grid.RowDefinitions> <RowDefinition Height="3*"></RowDefinition> <RowDefinition Height="2*"></RowDefinition> <RowDefinition Height="2*"></RowDefinition> <RowDefinition Height="2*"></RowDefinition> <RowDefinition Height="2*"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="110"></ColumnDefinition> <ColumnDefinition Width="100"></ColumnDefinition> <ColumnDefinition Width="100"></ColumnDefinition> <ColumnDefinition Width="100"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBox Text="1行1列 Grid.Row=0 Grid.Column=0(可以省略,省略时默认为1行1列)" Grid.Row="0" Grid.Column="0" Background="Violet" TextWrapping="Wrap" /> <TextBox Text="3行2列 Grid.Row=2 Grid.Column=1" Grid.Row="2" Grid.Column="1" Background="Beige" TextWrapping="Wrap" /> <TextBox Text="3行3列 Grid.Row=2 Grid.Column=2" Grid.Row="2" Grid.Column="2" Background="AliceBlue" TextWrapping="Wrap" /> <TextBox Text="5行1列 Grid.Row=4 Grid.Column=0 跨4列 Grid.ColumnSpan=4" Grid.Row="4" Grid.Column="0" Background="WhiteSmoke" Grid.ColumnSpan="4" /> </Grid> </Window>
<Grid> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition MinWidth="100"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition MinWidth="50"></ColumnDefinition> </Grid.ColumnDefinitions> <Button Grid.Row="0" Grid.Column="0" Margin="3">Left</Button> <Button Grid.Row="0" Grid.Column="2" Margin="3">Right</Button> <Button Grid.Row="1" Grid.Column="0" Margin="3">Left</Button> <Button Grid.Row="1" Grid.Column="2" Margin="3">Right</Button> <GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Width="3" VerticalAlignment="Stretch" HorizontalAlignment="Center" ShowsPreview="False"></GridSplitter> </Grid>
<!-- This is the Grid for the entire window. --> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <!-- This is the nested Grid on the left. It isn't subdivided further with a splitter. --> <Grid Grid.Column="0" VerticalAlignment="Stretch"> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Button Margin="3" Grid.Row="0">Top Left</Button> <Button Margin="3" Grid.Row="1">Bottom Left</Button> </Grid> <!-- This is the vertical splitter that sits between the two nested (left and right) grids. --> <GridSplitter Grid.Column="1" Width="3" HorizontalAlignment="Center" VerticalAlignment="Stretch" ShowsPreview="False"></GridSplitter> <!-- This is the nested Grid on the right. --> <Grid Grid.Column="2"> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Button Grid.Row="0" Margin="3">Top Right</Button> <Button Grid.Row="2" Margin="3">Bottom Right</Button> <!-- This is the horizontal splitter that subdivides it into a top and bottom region.. --> <GridSplitter Grid.Row="1" Height="3" VerticalAlignment="Center" HorizontalAlignment="Stretch" ShowsPreview="False"></GridSplitter> </Grid> </Grid>
<Grid Margin="3" Background="LightYellow" ShowGridLines="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="TextLabel"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <Label Margin="5">A very long bit of text</Label> <Label Grid.Column="1" Margin="5">More text</Label> <TextBox Grid.Column="2" Margin="5">A text box</TextBox> </Grid> ... <Grid Margin="3" Background="LightYellow" ShowGridLines="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="TextLabel"></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <Label Margin="5">Short</Label> <TextBox Grid.Column="1" Margin="5">A text box</TextBox> </Grid>
<Window x:Class="Layout.SimpleStack" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Layout" Height="223" Width="354" > <StackPanel> <Label>A Button Stack</Label> <Button>Button 1</Button> <Button>Button 2</Button> <Button>Button 3</Button> <Button>Button 4</Button> </StackPanel> </Window>
<StackPanel Orientation="Horizontal">
<Button Margin="5">Button 3</Button> <Button Margin="5,10,5,10">Button 3</Button> cmd.Margin = new Thickness(5); ...... <StackPanel Margin="3"> <Label Margin="3" HorizontalAlignment="Center"> A Button Stack</Label> <Button Margin="3" HorizontalAlignment="Left">Button 1</Button> <Button Margin="3" HorizontalAlignment="Right">Button 2</Button> <Button Margin="3">Button 3</Button> <Button Margin="3">Button 4</Button> </StackPanel>
<StackPanel Margin="3"> <Label Margin="3" HorizontalAlignment="Center"> A Button Stack</Label> <Button Margin="3" MaxWidth="200" MinWidth="100">Button 1</Button> <Button Margin="3" MaxWidth="200" MinWidth="100">Button 2</Button> <Button Margin="3" MaxWidth="200" MinWidth="100">Button 3</Button> <Button Margin="3" MaxWidth="200" MinWidth="100">Button 4</Button> </StackPanel>
<Window x:Class="WpfPanelExp.StackPanelExp" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="StackPanelExp" Height="300" Width="300"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="4*"></RowDefinition> <RowDefinition Height="6*"></RowDefinition> </Grid.RowDefinitions> <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center"> <TextBlock Text="相思" FontSize="24" FontFamily="MS UI Gothic" Margin="10,5,0,10" Background="Fuchsia" /> <TextBlock Text=" [作者]王维" FontSize="24" FontFamily="MS UI Gothic" Margin="10,5,0,10" Background="Aqua" /> </StackPanel> <StackPanel Grid.Row="1" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="红豆生南国" FontSize="24" FontFamily="MS UI Gothic" Margin="10,5,0,10" /> <TextBlock Text="春来发几枝" FontSize="24" FontFamily="MS UI Gothic" Margin="10,5,0,10" /> <TextBlock Text="愿君多采撷" FontSize="24" FontFamily="MS UI Gothic" Margin="10,5,0,10" /> <TextBlock Text="此物最相思" FontSize="24" FontFamily="MS UI Gothic" Margin="10,5,0,10" /> </StackPanel> </Grid> </Window>
<DockPanel LastChildFill="True"> <Button DockPanel.Dock="Top">Top Button</Button> <Button DockPanel.Dock="Bottom">Bottom Button</Button> <Button DockPanel.Dock="Left">Left Button</Button> <Button DockPanel.Dock="Right">Right Button</Button> <Button>Remaining Space</Button> </DockPanel>
<DockPanel LastChildFill="True"> <Button DockPanel.Dock="Top">A Stretched Top Button</Button> <Button DockPanel.Dock="Top" HorizontalAlignment="Center"> A Centered Top Button</Button> <Button DockPanel.Dock="Top" HorizontalAlignment="Left"> A Left-Aligned Top Button</Button> <Button DockPanel.Dock="Bottom">Bottom Button</Button> <Button DockPanel.Dock="Left">Left Button</Button> <Button DockPanel.Dock="Right">Right Button</Button> <Button>Remaining Space</Button> </DockPanel>
<Window x:Class="WpfPanelExp.DockPanelExp" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="DockPanelExp" Height="300" Width="300"> <Grid> <DockPanel> <TextBox Text="相思 [作者]王维" DockPanel.Dock="Top" Height="25" Background="Aqua" /> <TextBox Text="红豆生南国 春来发几枝 愿君多采撷 此物最相思" TextWrapping="Wrap" DockPanel.Dock="Left" Width="80" Background="SeaShell" /> <TextBox Text="《相思》是唐代诗人王维的作品,是一首借咏物而寄相思的诗作。此诗写相思之情,却全篇不离红豆,正用其相思子之名以关合相思之情。首句写红豆产地;次句以'发几枝'一问,语极朴实,而又极富形象性,设问自然,则暗逗情怀;三句寄意友人'多采撷',言在此而意在彼;末句点明其相思属性,且用一'最'字推达极致,则'多采撷'的理由自见,而自身所寄之意亦深含其中。全诗极为明快,却又委婉含蓄,语浅而情深,相传当时即为人谱曲传唱,流行江南。" TextWrapping="Wrap" Background="LawnGreen" /> </DockPanel> </Grid> </Window>
<Canvas> <Button Canvas.Left="10" Canvas.Top="10">(10,10)</Button> <Button Canvas.Left="120" Canvas.Top="30">(120,30)</Button> <Button Canvas.Left="60" Canvas.Top="80" Width="50" Height="50"> (60,80)</Button> <Button Canvas.Left="70" Canvas.Top="120" Width="100" Height="50"> (70,120)</Button> </Canvas>
<Window x:Class="WpfPanelExp.CanvasExp" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="CanvasExp" Height="300" Width="300"> <Grid> <Canvas> <TextBlock Text="相思" FontSize="24" FontFamily="MS UI Gothic" Margin="0,5,0,5" Background="Fuchsia" Canvas.Left="100" Canvas.Top="10"/> <TextBlock Text="[作者]王维" FontSize="24" FontFamily="MS UI Gothic" Margin="0,5,0,5" Background="Aqua" Canvas.Left="90" Canvas.Top="45" /> <TextBlock Text="红豆生南国" FontSize="24" FontFamily="MS UI Gothic" Margin="0,5,0,5" Canvas.Left="85" Canvas.Top="75"/> <TextBlock Text="春来发几枝" FontSize="24" FontFamily="MS UI Gothic" Margin="0,5,0,5" Canvas.Left="85" Canvas.Top="105"/> <TextBlock Text="愿君多采撷" FontSize="24" FontFamily="MS UI Gothic" Margin="0,5,0,5" Canvas.Left="85" Canvas.Top="135"/> <TextBlock Text="此物最相思" FontSize="24" FontFamily="MS UI Gothic" Margin="0,5,0,5" Canvas.Left="85" Canvas.Top="165"/> </Canvas> </Grid> </Window>
<WrapPanel> <Button>Button1</Button> <Button>Button2</Button> <Button>Button3</Button> <Button>Button4</Button> <Button>Button5</Button> <Button>Button6</Button> </WrapPanel>
<WrapPanel Margin="3"> <Button VerticalAlignment="Top">Top Button</Button> <Button MinHeight="60">Tall Button 2</Button> <Button VerticalAlignment="Bottom">Bottom Button</Button> <Button>Stretch Button</Button> <Button VerticalAlignment="Center">Centered Button</Button> </WrapPanel>
<Window x:Class="WpfPanelExp.WrapPanelExp" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WrapPanelExp" Height="300" Width="300"> <Grid> <WrapPanel Orientation="Vertical"> <Button Width="60" Height="60" Content="1"/> <Button Width="60" Height="60" Content="2"/> <Button Width="60" Height="60" Content="3"/> <Button Width="60" Height="60" Content="4"/> <Button Width="60" Height="60" Content="5"/> <Button Width="60" Height="60" Content="6"/> <Button Width="60" Height="60" Content="7"/> <Button Width="60" Height="60" Content="8"/> <Button Width="60" Height="60" Content="9"/> <Button Width="60" Height="60" Content="0"/> </WrapPanel> </Grid> </Window>
<Border Margin="5" Padding="5" Background="LightYellow" BorderBrush="SteelBlue" BorderThickness="3,5,3,5" CornerRadius="3" VerticalAlignment="Top"> <StackPanel> <Button Margin="3">One</Button> <Button Margin="3">Two</Button> <Button Margin="3">Three</Button> </StackPanel> </Border>
<DockPanel LastChildFill="True"> <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal"> <Button Margin="10,10,2,10" Padding="3">OK</Button> <Button Margin="2,10,10,10" Padding="3">Cancel</Button> </StackPanel> <TextBox DockPanel.Dock="Top" Margin="10">This is a test.</TextBox> </DockPanel>
<UniformGrid Rows="2" Columns="2"> <Button>Top Left</Button> <Button>Top Right</Button> <Button>Bottom Left</Button> <Button>Bottom Right</Button> </UniformGrid>
<Viewbox> <Canvas Width="18" Height="18" Background="YellowGreen"> </Canvas> </Viewbox>
<ScrollViewer HorizontalScrollBarVisibility="Auto"> <Ellipse Fill="YellowGreen" Width="800" Height="600"></Ellipse> </ScrollViewer>
<StackPanel> <Button>Button1</Button> <Button HorizontalAlignment="Left">Button2</Button> <Button HorizontalAlignment="Center">Button3</Button> </StackPanel> <StackPanel Orientation="Horizontal"> <Button>Button1</Button> <Button VerticalAlignment="Top">Button2</Button> <Button VerticalAlignment="Center">Button3</Button> </StackPanel> <WrapPanel Orientation="Horizontal" FlowDirection="RightToLeft"> <Button FlowDirection="RightToLeft">Button1</Button> <Button>Button2</Button> <Button>Button3</Button> <Button>Button4</Button> <Button FlowDirection="RightToLeft">This is Button5</Button> </WrapPanel> <Canvas> <Button Canvas.Left="10" Canvas.Top="10">Button1</Button> <Button Canvas.Left="25" Canvas.Top="25">Button2</Button> <Button Canvas.Left="40" Canvas.Top="40">Button3</Button> </Canvas> <Canvas> <Button Canvas.Left="10" Canvas.Top="10" Panel.ZIndex="1">Button1</Button> <Button Canvas.Left="25" Canvas.Top="25" Panel.ZIndex="3">Button2</Button> <Button Canvas.Left="40" Canvas.Top="40" Panel.ZIndex="2">Button3</Button> </Canvas> <Canvas> <Button Canvas.Left="50" Canvas.Top="40"> <TextBlock> <TextBlock.LayoutTransform> <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> </TextBlock.LayoutTransform> This is a Button! </TextBlock> </Button> <Button Canvas.Left="50" Canvas.Top="120"> <TextBlock> <TextBlock.RenderTransform> <ScaleTransform ScaleX="1" ScaleY="1"></ScaleTransform> </TextBlock.RenderTransform> This is a Button! </TextBlock> </Button> </Canvas>
<!--ContentPanel - 在此处放置其他内容--> <Grid x:Name="ContentPanel" Margin="8,9,4,3" Grid.Row="1"> <Grid.ColumnDefinitions > <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="25*"/> <RowDefinition Height="84*"/> <RowDefinition Height="59*"/> <RowDefinition Height="56*"/> <RowDefinition Height="66*"/> <RowDefinition Height="52*"/> </Grid.RowDefinitions> <Button Content="7" Grid.Row="2" Grid.Column="0" Click="DigitBtn_Click"/> <Button Content="8" Grid.Row="2" Grid.Column="1" Click="DigitBtn_Click"/> <Button Content="9" Grid.Row="2" Grid.Column="2" Click="DigitBtn_Click"/> <Button Content="4" Grid.Row="3" Grid.Column="0" Click="DigitBtn_Click"/> <Button Content="5" Grid.Row="3" Grid.Column="1" Click="DigitBtn_Click"/> <Button Content="6" Grid.Row="3" Grid.Column="2" Click="DigitBtn_Click"/> <Button Content="3" Grid.Row="4" Grid.Column="2" Click="DigitBtn_Click"/> <Button Content="2" Grid.Row="4" Grid.Column="1" Click="DigitBtn_Click"/> <Button Content="1" Grid.Row="4" Grid.Column="0" Click="DigitBtn_Click"/> <Button Content="0" Grid.Row="5" Grid.Column="0" Click="DigitBtn_Click"/> <Button Content="+" Grid.Row="2" Grid.Column="3" Click="Operation_Click"/> <Button Content="-" Grid.Row="3" Grid.Column="3" Click="Operation_Click"/> <Button Content="*" Grid.Row="4" Grid.Column="3" Click="Operation_Click"/> <Button Content="/" Grid.Row="5" Grid.Column="3" Click="Operation_Click"/> <Button Content="DEL" Grid.Row="5" Grid.Column="2" Click="Del_Click"/> <Button Content="=" Grid.Row="5" Grid.Column="1" Click="Result_Click"/> <TextBlock Name="OperationResult" FontSize="100" Grid.Row="1" Margin="6,17,10,17" Grid.ColumnSpan="4" HorizontalAlignment="Right"></TextBlock> <TextBlock Name="InputInformation" Grid.Row="0" Margin="6,12,10,11" Grid.ColumnSpan="4" HorizontalAlignment="Right"></TextBlock> </Grid> <!--取消注释,以显示对齐网格,从而帮助确保 控件在公用边界上对齐。图像在系统栏中显示时的 上边距为 -32px。如果隐藏了系统栏,则将此值设为 0 (或完全删除边距)。 在发送之前删除此 XAML 和图像本身。--> <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />--> </Grid>
<Window x:Class="OACt_WPFClient.布局的练习" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="计算器" Icon="IMG/App.ico" Height="350" Width="270"> <Grid> <Grid> <Menu HorizontalAlignment="Stretch" VerticalAlignment="Top" FontSize="13"> <MenuItem Header="查看(V)"></MenuItem> <MenuItem Header="编辑(E)"></MenuItem> <MenuItem Header="帮助(H)"></MenuItem> </Menu> <TextBox VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="10,30,10,10" Height="45" BorderBrush="GreenYellow" ></TextBox> <Grid Margin="10,80,10,10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Button Content="MC" Margin="4" Grid.Column="0" Grid.Row="0"></Button> <Button Content="MR" Margin="4" Grid.Column="1" Grid.Row="0"></Button> <Button Content="MS" Margin="4" Grid.Column="2" Grid.Row="0"></Button> <Button Content="M+" Margin="4" Grid.Column="3" Grid.Row="0"></Button> <Button Content="M-" Margin="4" Grid.Column="4" Grid.Row="0"></Button> <Button Content="-" Margin="4" Grid.Column="0" Grid.Row="1"></Button> <Button Content="CE" Margin="4" Grid.Column="1" Grid.Row="1"></Button> <Button Content="C" Margin="4" Grid.Column="2" Grid.Row="1"></Button> <Grid Margin="4" Grid.Column="3" Grid.Row="1"> <Button > <Button.Content> <StackPanel> <Label Content="-" Margin="2,2,0,0" Height="20" ></Label> <Label Content="+" Margin="0,-28,0,0" Height="20"></Label> </StackPanel> </Button.Content> </Button> </Grid> <Button Content="V" Margin="4" Grid.Column="4" Grid.Row="1"></Button> <Button Content="7" Margin="4" Grid.Column="0" Grid.Row="2"></Button> <Button Content="8" Margin="4" Grid.Column="1" Grid.Row="2"></Button> <Button Content="9" Margin="4" Grid.Column="2" Grid.Row="2"></Button> <Button Content="/" Margin="4" Grid.Column="3" Grid.Row="2"></Button> <Button Content="%" Margin="4" Grid.Column="4" Grid.Row="2"></Button> <Button Content="4" Margin="4" Grid.Column="0" Grid.Row="3"></Button> <Button Content="5" Margin="4" Grid.Column="1" Grid.Row="3"></Button> <Button Content="6" Margin="4" Grid.Column="2" Grid.Row="3"></Button> <Button Content="*" Margin="4" Grid.Column="3" Grid.Row="3"></Button> <Button Content="1/X" Margin="4" Grid.Column="4" Grid.Row="3"></Button> <Button Content="1" Margin="4" Grid.Column="0" Grid.Row="4"></Button> <Button Content="2" Margin="4" Grid.Column="1" Grid.Row="4"></Button> <Button Content="3" Margin="4" Grid.Column="2" Grid.Row="4"></Button> <Button Content="-" Margin="4" Grid.Column="3" Grid.Row="4"></Button> <Button Content="=" Margin="4" Grid.Column="4" Grid.Row="4" Grid.RowSpan="2"></Button> <Button Content="0" Margin="4" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2"></Button> <Button Content="." Margin="4" Grid.Column="2" Grid.Row="5"></Button> <Button Content="+" Margin="4" Grid.Column="3" Grid.Row="5"></Button> </Grid> </Grid> </Grid> </Window>
<Window x:Class="AddressBook.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="AddressBook" Loaded="WindowLoaded" SizeToContent="WidthAndHeight" MinWidth="640" MinHeight="480"> <Grid Background="White" Name="DocumentRoot"> <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <!-- Menu --> <RowDefinition Height="Auto"/> <!-- Tool Bar --> <RowDefinition Height="*"/> <!-- Content Area --> <RowDefinition Height="Auto"/> <!-- Status Bar --> </Grid.RowDefinitions> </Grid> </Window>
<!—Menu Bar--> <DockPanel Name="DockPanel_Menu" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0"> <Menu Background="White"> <MenuItem Header="File"> <MenuItem Header="New Contact" Click="LaunchNewContactWizard"/> <MenuItem Header="New Group" Click="NotImplementedMsg"/> <Separator /> <MenuItem Header="Properties" Click="NotImplementedMsg"/> <MenuItem Header="Delete" Click="NotImplementedMsg"/> <MenuItem Header="Import"> <MenuItem Header="Address book (WAB)..." Click="NotImplementedMsg"/> <MenuItem Header="Business card vCard)..." Click="NotImplementedMsg"/> </MenuItem> <Separator /> <MenuItem Header="Exit" InputGestureText="Alt-F4" Click="ExitApplication"> <MenuItem.ToolTip> <ToolTip> Click here to exit </ToolTip> </MenuItem.ToolTip> </MenuItem> </MenuItem> </Menu> <Menu Background="White"> <MenuItem Header="Edit"> <MenuItem Command="ApplicationCommands.Copy"/> <MenuItem Command="ApplicationCommands.Paste"/> </MenuItem> </Menu> </DockPanel>
<!-- Tool Bar --> <DockPanel Name="DockPanel_Toolbar" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1"> <ToolBar> <Button Click="LaunchNewContactWizard" ToolTip="Add Contact"> + </Button> <Button Click="NotImplementedMsg" ToolTip="Delete Contact"> - </Button> </ToolBar> </DockPanel>
<!-- Left Pane for contact list view --> <DockPanel Name="DockPanel_LeftPane" Grid.Column="0" Grid.Row="2"> <ListBox Name="allContacts" SelectionChanged="ListItemSelected"> <ListBox.ContextMenu> <ContextMenu> <MenuItem Header="Add a Contact" Click="LaunchNewContactWizard"/> <MenuItem Header="Add a Group" Click="NotImplementedMsg"/> </ContextMenu> </ListBox.ContextMenu> </ListBox> </DockPanel>
<!-- Status Bar --> <DockPanel Name="DockPanel_Statusbar" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3"> <StatusBar BorderBrush="Black" BorderThickness="1"> <TextBlock Name="tb" Foreground="Black"> Status bar </TextBlock> </StatusBar> </DockPanel>
<!-- RightPanel --> <Frame Name="Frame_RightPane" Grid.Column="1" Grid.Row="2"/>
http://tech.it168.com/a2009/1203/819/000000819385.shtml
http://blog.csdn.net/bcbobo21cn/article/details/19676649
标签:
原文地址:http://blog.csdn.net/bcbobo21cn/article/details/51225736