WPF Button LinkButton 綁定多個值 Template

效果以下:sass

 

 代碼以下:spa

<Button Click="InventoryDetail_OnClick" Template="{StaticResource InventoryButton}" />

 

 

<!-- Link Button -->
<ControlTemplate x:Key="InventoryButton" TargetType="{x:Type Button}">
    <TextBlock x:Name="txtInventory"  Cursor="Hand" Foreground="#4587F0" VerticalAlignment="Bottom"  HorizontalAlignment="Center" >
        <TextBlock.Text>
            <MultiBinding StringFormat="{}{0:###0.####}{1}{2:###0.####}{3}">
                <Binding Path="deptMinQuantity"></Binding>
                <Binding Path="minPackageUnit"></Binding>
                <Binding Path="deptDisassemblyQty"></Binding>
                <Binding Path="disassemblyUnit"></Binding>
            </MultiBinding>
        </TextBlock.Text>
    </TextBlock>
    <ControlTemplate.Triggers>
        <Trigger Property="IsFocused" Value="True"/>
        <Trigger Property="IsDefaulted" Value="True"/>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="TextDecorations" Value="Underline" TargetName="txtInventory">
            </Setter>
        </Trigger>
        <Trigger Property="IsPressed" Value="True"/>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Foreground" Value="#FFD6D4D4"></Setter>
        </Trigger>
    </ControlTemplate.Triggers>
</ControlTemplate>
相關文章
相關標籤/搜索