Skip to content

Instantly share code, notes, and snippets.

@sjehutch
Last active August 24, 2020 11:31
Show Gist options
  • Save sjehutch/d1add7ad3466ff18ad2b1231c2454502 to your computer and use it in GitHub Desktop.
Save sjehutch/d1add7ad3466ff18ad2b1231c2454502 to your computer and use it in GitHub Desktop.
Property For MVVM Trigger
<Label Text="{Binding LocationLine}" FontSize="Small">
<Label.Triggers >
<DataTrigger TargetType="Label" Binding="{Binding LocationLine}" Value="NA">
<Setter Property="TextColor" Value="Gray"/>
</DataTrigger>
</Label.Triggers>
</Label>
<Label Text="{Binding ContainerLine}" FontSize="Small">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding ContainerLine}" Value="NA">
<Setter Property="TextColor" Value="Gray"/>
</DataTrigger>
</Label.Triggers>
</Label>
public string LocationLine
{
get
{
StringBuilder sb = new StringBuilder();
sb.Append(this.Location);
if (this.StartAirport != null || this.EndAirport != null)
{
sb.AppendFormat(": {0} - {1}", this.StartAirport?.icao, this.EndAirport?.icao);
}
if (sb.Length == 0) sb.Append("NA");
return sb.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment