MainWindow.xaml

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<Window x:Class="StylingIntroSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:StylingIntroSample"
        Loaded="WindowLoaded" 
        Title="StylingIntroSample" SizeToContent="WidthAndHeight">
  <Window.Resources>
    <ObjectDataProvider x:Key="MyPhotos"
      ObjectType="{x:Type local:PhotoList}"/>

    <!--A Style that affects all TextBlocks-->
    <Style TargetType="TextBlock">
      <Setter Property="HorizontalAlignment" Value="Center" />
      <Setter Property="FontFamily" Value="Comic Sans MS"/>
      <Setter Property="FontSize" Value="14"/>
    </Style>

    <!--A Style that extends the previous TextBlock Style-->
    <!--This is a "named style" with an x:Key of TitleText-->
    <Style BasedOn="{StaticResource {x:Type TextBlock}}"
           TargetType="TextBlock"
           x:Key="TitleText">
      <Setter Property="FontSize" Value="26"/>
      <Setter Property="Foreground">
      <Setter.Value>
          <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
            <LinearGradientBrush.GradientStops>
              <GradientStop Offset="0.0" Color="#90DDDD" />
              <GradientStop Offset="1.0" Color="#5BFFFF" />
            </LinearGradientBrush.GradientStops>
          </LinearGradientBrush>
        </Setter.Value>
      </Setter>
    </Style>

    <!--Horizontal ListBox Control Template-->
    <Style TargetType="ListBox">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="ListBox">
            <Border CornerRadius="5" Background="{TemplateBinding ListBox.Background}">
              <ScrollViewer HorizontalScrollBarVisibility="Auto">
                <StackPanel Orientation="Horizontal"
                           VerticalAlignment="Center"
                           HorizontalAlignment="Center"
                           IsItemsHost="True"/>
              </ScrollViewer>
            </Border>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    
    <!--DataTemplate to display Photos as images
        instead of text strings of Paths-->
    <DataTemplate DataType="{x:Type local:Photo}">
      <Border Margin="3">
        <Image Source="{Binding Source}"/>
      </Border>
    </DataTemplate>
后面还有 46 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。