StaticResource和DynamicResource使用

    <Window.Resources>
        <TextBlock x:Key="Res1" Text="海上生明月"/>
        <TextBlock x:Key="Res2" Text="海上生明月"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Button Grid.Column="0" Grid.Row="0" Content="{StaticResource Res1}"/>
        <Button Grid.Column="1" Grid.Row="0" Content="{DynamicResource Res2}"/>
        <Button Grid.Column="1" Grid.Row="1" Content="UpDate" Click="Button_Click"/>
    </Grid>

猜你喜欢

转载自www.cnblogs.com/liuxinyong/p/11440936.html
今日推荐