Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] [CollectionView] [iOS] DataTriggers are not being fired for Label + Spans #10432

@mkieres

Description

@mkieres

Description

DataTriggers in the ItemTemplate of a CollectionView that has a child of a Label that has Spans are not being triggered on iOS. This potentially also happens for Labels without Spans - I have not checked that though.

Same code on Android is working fine.

Steps to Reproduce

I don't have a repro sample or steps but I'm running into an issue where a Label doesn't show up (IsVisible is not changing) even though the property has ben set raised changed event.

<Label Grid.Column="1"
	   Grid.Row="1"
	   VerticalOptions="Center"
	   HorizontalTextAlignment="Start"
	   IsVisible="False">
	<Label.FormattedText>
		<FormattedString>
			<Span Text="{Binding Value, StringFormat='{0:F0}', Mode=OneWay}"
				  Style="{StaticResource BaseBoldContentTextStyle}"
				  FontSize="{StaticResource LargeFontSize}" />
			<Span Text="{Binding Unit, Mode=OneWay}"
				  Style="{StaticResource UnitStyle}" />
		</FormattedString>
	</Label.FormattedText>

	<Label.Triggers>
		<DataTrigger TargetType="Label"
					 Binding="{Binding SomeVisualState, Mode=OneWay}"
					 Value="{x:Static visualStates:VisualStates+PageName+VisualStateEnum.EnumValue1}">
			<Setter Property="IsVisible"
					Value="True" />
		</DataTrigger>
		<DataTrigger TargetType="Label"
					 Binding="{Binding SomeVisualState, Mode=OneWay}"
					 Value="{x:Static visualStates:VisualStates+PageName+VisualStateEnum.EnumValue2}">
			<Setter Property="IsVisible"
					Value="True" />
		</DataTrigger>
		<DataTrigger TargetType="Label"
					 Binding="{Binding SomeVisualState, Mode=OneWay}"
					 Value="{x:Static visualStates:VisualStates+PageName+VisualStateEnum.EnumValue3}">
			<Setter Property="IsVisible"
					Value="True" />
		</DataTrigger>
	</Label.Triggers>
</Label>

The important thing to note here is that this is not always the case. It happens after a bit of fiddling with the ItemsSource of the CollectionView. Reordering, updating some other properties of the ItemTemplate etc.

Once I have some time I might create a sample repro.

Expected Behavior

The DataTrigger is being fired and the UI is updated accordingly.

Actual Behavior

The DataTrigger is not being fired (assumption) and the UI is not updated.

Basic Information

  • Version with issue: 4.5.0.657
  • Last known good version: ?
  • IDE: Visual Studio for Mac 8.5.3 (build 16)
  • Platform Target Frameworks:
    • iOS: Mono 6.8.0.123

Screenshots

None at this time

Reproduction Link

None at this time

Workaround

Instead of manipulating the IsVisible flag I am clearing the text of the Label, so it doesn't show text.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions