Last active
August 24, 2020 11:31
-
-
Save sjehutch/d1add7ad3466ff18ad2b1231c2454502 to your computer and use it in GitHub Desktop.
Property For MVVM Trigger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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