window1.xaml

来自「C#高级编程第6版随书源代码 值得下载」· XAML 代码 · 共 48 行

XAML
48
字号
<Window x:Class="ServiceControl.ServiceControlWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Service Control" Height="300" Width="466"
    >
  <Window.Resources>
      <DataTemplate x:Key="listTemplate">
        <Label Content="{Binding Path=DisplayName}"/>
      </DataTemplate>
  </Window.Resources>
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="0.408296943231441*" />
      <ColumnDefinition Width="0.591703056768559*" />
    </Grid.ColumnDefinitions>
    <Grid Margin="6,11,14,7" MinHeight="50" MinWidth="50" Name="grid1" Grid.Column="1"  >
      <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
        <RowDefinition />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="0.48*" />
        <ColumnDefinition Width="0.52*" />
      </Grid.ColumnDefinitions>
      <TextBox Grid.Row="0" Grid.ColumnSpan="2" Name="textDisplayName"  Text="{Binding Path=DisplayName, Mode=OneTime}"></TextBox>
      <TextBox Grid.Row="1" Grid.ColumnSpan="2" Name="textStatus" Text="{Binding Path=ServiceStatusName, Mode=OneTime}" />
      <TextBox Grid.Row="2" Grid.ColumnSpan="2" Name="textType" Text="{Binding Path=ServiceTypeName, Mode=OneTime}" />
      <TextBox Grid.Row="3" Grid.ColumnSpan="2" Name="textName" Text="{Binding Path=ServiceName, Mode=OneTime}" />
      <Button Grid.Row="4" Grid.Column="0" Name="buttonStart" Content="Start" IsEnabled="{Binding Path=EnableStart, Mode=OneTime}" />
      <Button Grid.Row="4" Grid.Column="1" Name="buttonStop" Content="Stop" IsEnabled="{Binding Path=EnableStop, Mode=OneTime}" />
      <Button Grid.Row="5" Grid.Column="0" Name="buttonPause" Content="Pause" IsEnabled="{Binding Path=EnablePause, Mode=OneTime}" />
      <Button Grid.Row="5" Grid.Column="1" Name="buttonContinue" Content="Continue" IsEnabled="{Binding Path=EnableContinue, Mode=OneTime}" />
      <Button Grid.Row="6" Grid.Column="0" Name="buttonRefresh" Content="Refresh" />
      <Button Grid.Row="6" Grid.Column="1" Name="buttonExit" Content="Exit" />
      
      
      
    </Grid>
      <ListBox Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Name="listBoxServices" VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" ItemTemplate="{StaticResource listTemplate}">
      </ListBox>
  </Grid>
</Window>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?