I would split it into two TextBlocks and change the visibility only with a trigger. Using Inlines and trying to change Text in a trigger, you are likely to run into priority problems, and Inlines cannot be Inlines on Setter .
eg.
<StackPanel Grid.Column="2" Grid.Row="0" Orientation="Horizontal"> <TextBlock Text="{Binding HonorificVm.DisplayName}" Margin="0,0,5,0"> <TextBlock.Style> <Style TargetType="TextBlock"> <Style.Triggers> <DataTrigger Binding="{Binding HonorificVm.Honorific}" Value="{x:Static model:Honorific.NullHonorific}"> <Setter Property="Visibility" Value="Collapsed" /> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock> <TextBlock Text="{Binding PersonNameVm.DisplayName}" /> </StackPanel>
An alternative would be MultiBinding instead of Inlines :
<TextBlock Grid.Column="2" Grid.Row="0"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Setter Property="Text"> <Setter.Value> <MultiBinding StringFormat="{}{0} {1}"> <Binding Path="HonorificVm.DisplayName" /> <Binding Path="PersonNameVm.DisplayName" /> </MultiBinding> </Setter.Value> </Setter> <Style.Triggers> <DataTrigger Binding="{Binding HonorificVm.Honorific}" Value="{x:Static model:Honorific.NullHonorific}"> <Setter Property="Text" Value="{Binding PersonNameVm.DisplayName}" /> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock>
source share