zoukankan      html  css  js  c++  java
  • 控件模板 1

    简单的使用控件模板

    <Button FontSize="15" HorizontalAlignment="Center" Content="Hello" Width="120" Height="30">
                <Button.Template>
                    <ControlTemplate>
                        <Grid>
                            <Rectangle Fill="Red" RadiusX="15" RadiusY="15"/>
                            <TextBlock Name="textBlock" Margin="{TemplateBinding Button.Padding}" VerticalAlignment="Center"
                                        HorizontalAlignment="Center" Text="{TemplateBinding Button.Content}"/>
                        </Grid>
                    </ControlTemplate>
                </Button.Template>
            </Button>

    使用资源

    <Window.Resources>
            <ControlTemplate x:Key="buttontemplate" TargetType="{x:Type Button}">
                <Border BorderBrush="Orange" BorderThickness="4" CornerRadius="3"
                        Background="Red" TextBlock.Foreground="Black" Margin="30">
                    <ContentPresenter RecognizesAccessKey="True" HorizontalAlignment="Center"
                                       VerticalAlignment="Center"></ContentPresenter>
                </Border>
            </ControlTemplate>
        </Window.Resources>
        <StackPanel>
            <Button FontSize="15" Template="{StaticResource ResourceKey=buttontemplate}" Content="Hello">
            </Button>
        </StackPanel>

  • 相关阅读:
    MapServer:地图发布工具
    hdu1054(二分图匹配)
    hdu 5091(线段树+扫描线)
    hdu1828(线段树+扫描线)
    hdu2847(暴力)
    hdu1052(田忌赛马 贪心)
    hdu1051(LIS | Dilworth定理)
    hdu1050(贪心)
    poj 2773(容斥原理)
    hdu 1044(bfs+状压)
  • 原文地址:https://www.cnblogs.com/KimhillZhang/p/2422476.html
Copyright © 2011-2022 走看看