效果如下:

WPF Button LinkButton 绑定多个值 Template_sed

 

 代码如下:

<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>