Topic Author
Posts: 5
Joined: 06 Jul 2023, 08:49

NotifyArrayChanged in UE Question

08 Sep 2023, 08:27

Hello, I'd like to ask a question about using NotifyArrayChanged in UE.

I have an Array (PlayBulletBars) as the itemsSource of an ItemsControl. PlayBulletBars is an array of UBulletVisible class.The class UBulletVisible has a FString property named BulletVisible.

And, within the ContentControl that is bound in the ItemTemplate, I bind the Visibility of an image to a property "BulletVisible". Additionally, I added a behavior to this ContentControl that plays an animation when Visibility == {x:Static Visibility.Visible}.

When I modify a specific UBulletVisible in PlayBulletBars within the ViewModel code, I call Noesis::NotifyArrayChanged(this, "PlayBulletBars").

However, the actual behavior is that every time I modify the Visibility of one item(Gain Bullet), all bullet items play the animation.

ItemsControl code
	<ItemsControl x:Name="bar" ItemsSource="{Binding PlayBulletBars}">
				<StackPanel Orientation="Horizontal"/>
				<ContentControl Content="{Binding}" Style="{StaticResource Style.BulletBarSlot}">
ContentControl Code
	<ControlTemplate x:Key="BulletBarSlot" TargetType="{x:Type ContentControl}">
			<Storyboard x:Key="GainBulletStoryboard">
				<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="bullet">
					<EasingDoubleKeyFrame KeyTime="0" Value="-120">
							<BackEase EasingMode="EaseOut"/>
					<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0">
							<BackEase EasingMode="EaseOut"/>
		<Grid Width="58" Height="103">
			<Image x:Name="bg" HorizontalAlignment="Center" Source="{StaticResource Game/CombatHUD/T_UI_Bullet_Bg}"/>
			<Image x:Name="bullet" HorizontalAlignment="Center" Source="{StaticResource Game/CombatHUD/T_UI_Bullet}" Visibility="{Binding BulletVisible}" RenderTransformOrigin="0.5,0.5">
					<b:DataTrigger Binding="{Binding Visibility, ElementName=bullet}" Value="{x:Static Visibility.Visible}">
						<b:ControlStoryboardAction Storyboard="{StaticResource GainBulletStoryboard}"/>
	<Style x:Key="Style.BulletBarSlot" TargetType="{x:Type ContentControl}">
		<Setter Property="Template" Value="{StaticResource BulletBarSlot}"/>
ViewModel Code(I use AngleScript)
	void DebugGainBulletBar()
		for (int Index = 0, Num = PlayBulletBars.Num(); Index < Num; ++Index)
			UBulletVisible CurBar = PlayBulletBars[Index];
			if (CurBar.BulletVisible != "Visible"){
				CurBar.BulletVisible = "Visible";
		Noesis::NotifyArrayChanged(this, n"PlayBulletBars");


When Click GainBullet .

So, is it because NotifyArray always updates all items every time? Is there a better way to achieve playing animation only for the item that has its status changed?
User avatar
Site Admin
Posts: 308
Joined: 09 Feb 2012, 12:40

Re: NotifyArrayChanged in UE Question

10 Sep 2023, 15:58


Instead of notifying the array has changed, could you try notifying the element of the object has changed like this:

Noesis::NotifyChanged(CurBar, “BulletVisible”);
Topic Author
Posts: 5
Joined: 06 Jul 2023, 08:49

Re: NotifyArrayChanged in UE Question

11 Sep 2023, 04:02

Thank you!

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests