это должно быть очень просто, но это утро понедельника ... У меня есть ярлык и переопределен шаблон с рамкой. когда я устанавливаю statusLabel.Content в значение null, я ожидаю, что метка станет невидимой, но вместо этого граница метки все еще остается. Как избавиться от границы только тогда, когда statusLabel.Content имеет значение null? ниже - связанный xaml:
<StackPanel Orientation="Horizontal">
<Image Name="statusImage"
Stretch="None"
VerticalAlignment="Top"
Margin="20, 20, 0, 0"/>
<Label Name="statusLabel"
Margin="20, 20, 0, 0"
VerticalAlignment="Top"
Background="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:StatusLayer}, Path=StatusTextBackground}"
FontSize ="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:StatusLayer}, Path=FontSize}"
FontStyle="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:StatusLayer}, Path=FontStyle}"
FontWeight="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:StatusLayer}, Path=FontWeight}"
Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:StatusLayer}, Path=StatusTextForeground}"
FontFamily="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:StatusLayer}, Path=FontFamily}" >
<Label.Template>
<ControlTemplate TargetType="{x:Type Label}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true" CornerRadius="5">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Label.Template>
</Label>
</StackPanel>
ОБНОВЛЕНИЕ: спасибо за код в ваших ответах, он показал мне, что мои предыдущие попытки заставить границу исчезнуть потерпели неудачу, потому что триггер, который я тестировал ранее (не указан в моем коде вопроса), включен Value = "null" вместо Value = "{x: Null}" ... DOH! использование правильного триггера с настройкой видимости на ярлыке работает отлично.