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>

 

posted @ 2019-08-31 23:09  水獭人  阅读(398)  评论(0编辑  收藏  举报