zoukankan      html  css  js  c++  java
  • StaticResource

    内部定义

    <phone:PhoneApplicationPage.Resources>
      <Style x:Key="color" TargetType="TextBlock">
        <Setter Property="FontSize" Value="20"></Setter>
      </Style>
      <Style x:Key="font" TargetType="TextBox">
        <Setter Property="Background" Value="Blue"></Setter>
      </Style>
      <BitmapImage UriSource="/Icons/20130601210710.jpg" x:Key="logo"></BitmapImage>
    </phone:PhoneApplicationPage.Resources>

    外部定义[app.xaml]

    <Application.Resources>
    <BitmapImage UriSource="/Icons/20130601210710.jpg" x:Key="logo1"></BitmapImage>
    <BitmapImage UriSource="/Icons/20130605085539.jpg" x:Key="logo2"></BitmapImage>
    <BitmapImage UriSource="/Icons/appbar.back.rest.png" x:Key="logo3"></BitmapImage>
    <BitmapImage UriSource="/Icons/appbar.cancel.rest.png" x:Key="logo4"></BitmapImage>
    <Style x:Key="aaa" TargetType="TextBox">
    <Setter Property="Height" Value="550"></Setter>

    </Style>
    </Application.Resources>

    调用

    <Image Height="150" HorizontalAlignment="Left" Margin="182,87,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="200" DataContext="{Binding}" Source="{StaticResource logo1}" />

    <Image Height="150" HorizontalAlignment="Left" Margin="182,287,0,0" Name="image2" Stretch="Fill" VerticalAlignment="Top" Width="200" DataContext="{Binding}" Source="{StaticResource logo2}" Grid.RowSpan="2" />
    <TextBlock Style="{StaticResource color}" Height="147" HorizontalAlignment="Left" Margin="10,10,0,0" Name="textBlock1" Text="TextBlock" VerticalAlignment="Top" Width="166" />
    <TextBox Style="{StaticResource aaa}" HorizontalAlignment="Left" Margin="6,113,0,0" Name="textBox1" Text="TextBox" VerticalAlignment="Top" Width="460" />

  • 相关阅读:
    集合的笼统介绍之Collection
    集合的笼统介绍之ArrayList
    final关键字+static关键字+匿名对象
    多态
    练习018:搜索插入位置
    练习017:实现strStr()
    练习016:移除元素
    练习015:删除排序数组中的重复项
    练习014:合并两个有序链表
    用JS实现链表
  • 原文地址:https://www.cnblogs.com/yuluhuang/p/3316854.html
Copyright © 2011-2022 走看看