Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WheelWizard/Views/Layout.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
Margin="0,0,0,25">
<components:StateBox x:Name="PlayerCountBox" Text="0" Variant="Dark"
IconData="{StaticResource UserCouple}"
TipText="{x:Static lang:Phrases.Hover_PlayersOnline_0}"
ToolTip.Tip="{x:Static lang:Phrases.Hover_PlayersOnline_0}"
Margin="10,0,0,0" />
<components:StateBox x:Name="RoomCountBox" Text="0" Variant="Dark"
IconData="{StaticResource RoomUsers}"
TipText="{x:Static lang:Phrases.Hover_RoomsOnline_0}"
ToolTip.Tip="{x:Static lang:Phrases.Hover_RoomsOnline_0}"
Margin="10,0,0,0" />
Comment on lines 69 to 76
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify how StateBox template handles tooltips
echo "=== StateBox.axaml tooltip binding ==="
rg -n "ToolTip.Tip" --type=xml -C3 -g "*StateBox*"

echo ""
echo "=== TipText property definition ==="
ast-grep --pattern $'public static readonly StyledProperty<string> TipTextProperty = $_'

Repository: TeamWheelWizard/WheelWizard

Length of output: 853


🏁 Script executed:

fd -type f "StateBox.axaml.cs"

Repository: TeamWheelWizard/WheelWizard

Length of output: 241


🏁 Script executed:

# Search for TipText property in StateBox files
rg -n "TipText" -C5 -g "*StateBox*"

Repository: TeamWheelWizard/WheelWizard

Length of output: 5855


Set TipText property instead of ToolTip.Tip attached property on StateBox controls.

The StateBox template (in StateBox.axaml:30) binds its internal Border's tooltip via ToolTip.Tip="{TemplateBinding TipText}". Setting ToolTip.Tip directly on the StateBox control here will not work because the TemplateBinding explicitly binds to the TipText property, which remains unset.

Use the TipText property instead (as seen in other StateBox usages in the codebase):

Example fix
-            <components:StateBox x:Name="PlayerCountBox" Text="0" Variant="Dark"
+            <components:StateBox x:Name="PlayerCountBox" Text="0" Variant="Dark" TipText="..."
                                  IconData="{StaticResource UserCouple}"
-                                 ToolTip.Tip="{x:Static lang:Phrases.Hover_PlayersOnline_0}"
                                  Margin="10,0,0,0" />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@WheelWizard/Views/Layout.axaml` around lines 69 - 76, The StateBox instances
(PlayerCountBox and RoomCountBox) are setting the attached ToolTip.Tip instead
of the control's TipText property which the template binds to via
TemplateBinding; change the properties on these StateBox controls to set TipText
(e.g., TipText="{x:Static lang:Phrases.Hover_PlayersOnline_0}" and
TipText="{x:Static lang:Phrases.Hover_RoomsOnline_0}") so the template's Border
tooltip receives the value.

</StackPanel>

Expand Down
34 changes: 19 additions & 15 deletions WheelWizard/Views/Layout.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
using WheelWizard.Settings.Types;
using WheelWizard.Shared.DependencyInjection;
using WheelWizard.Utilities.RepeatedTasks;
using WheelWizard.Views.Components;
using WheelWizard.Views.Pages;
using WheelWizard.Views.Patterns;
using WheelWizard.Views.Popups.Generic;
using WheelWizard.WheelWizardData.Domain;
using WheelWizard.WiiManagement;
using WheelWizard.WiiManagement.GameLicense;

namespace WheelWizard.Views;
Expand Down Expand Up @@ -198,20 +196,26 @@ public void UpdatePlayerAndRoomCount(RRLiveRooms sender)
var playerCount = sender.PlayerCount;
var roomCount = sender.RoomCount;
PlayerCountBox.Text = playerCount.ToString();
PlayerCountBox.TipText = playerCount switch
{
1 => Phrases.Hover_PlayersOnline_1,
0 => Phrases.Hover_PlayersOnline_0,
_ => Humanizer.ReplaceDynamic(Phrases.Hover_PlayersOnline_x, playerCount)
?? $"There are currently {playerCount} players online",
};
ToolTip.SetTip(
PlayerCountBox,
playerCount switch
{
1 => Phrases.Hover_PlayersOnline_1,
0 => Phrases.Hover_PlayersOnline_0,
_ => Humanizer.ReplaceDynamic(Phrases.Hover_PlayersOnline_x, playerCount)
?? $"There are currently {playerCount} players online",
}
);
RoomCountBox.Text = roomCount.ToString();
RoomCountBox.TipText = roomCount switch
{
1 => Phrases.Hover_RoomsOnline_1,
0 => Phrases.Hover_RoomsOnline_0,
_ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) ?? $"There are currently {roomCount} rooms active",
};
ToolTip.SetTip(
RoomCountBox,
roomCount switch
{
1 => Phrases.Hover_RoomsOnline_1,
0 => Phrases.Hover_RoomsOnline_0,
_ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) ?? $"There are currently {roomCount} rooms active",
}
);
Comment on lines +199 to +218
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Avalonia ToolTip attached property inheritance vs TemplateBinding precedence

💡 Result:

In Avalonia, these are two separate mechanisms:

1) Inheritance (“inherits: true”) is low precedence

Property inheritance only applies to properties registered with inherits: true, and inherited values use BindingPriority.Inherited, which is lower priority than styles and templates. (docs.avaloniaui.net)

So even if an attached property is inheritable, an inherited value will lose to any template-provided value.

2) TemplateBinding is BindingPriority.Template (higher than styles + inheritance)

Values coming from a ControlTemplate (including TemplateBinding) use BindingPriority.Template, which is higher priority than Style and Inherited. (docs.avaloniaui.net)

Implication: if a template part sets ToolTip.Tip="{TemplateBinding ToolTip.Tip}", then:

  • A style setter on that template part generally won’t override it (style is lower priority than template). (docs.avaloniaui.net)
  • A local value on that template part will override it (local is higher than template). (docs.avaloniaui.net)

3) ToolTip.Tip specifically: don’t assume it inherits

ToolTip.Tip is an attached property defined by ToolTip. (docs.avaloniaui.net)
But not all tooltip attached properties are inheritable (e.g., ShowOnDisabled is explicitly registered as inheritable in Avalonia). (stackoverflow.com)
So if you’re expecting ToolTip.Tip to “flow down” the tree via inheritance, it may not—whereas TemplateBinding will still copy the templated parent’s value into the template part.

Practical rule of thumb

  • If you want the tooltip content to be customizable from the control instance, bind it in the template (TemplateBinding).
  • If you want to override the tooltip on a specific element inside the template, set ToolTip.Tip locally on that element (or modify the template), because plain style setters typically won’t beat a template-set value. (docs.avaloniaui.net)

Citations:


🏁 Script executed:

find . -type f -name "StateBox.axaml*" | head -5

Repository: TeamWheelWizard/WheelWizard

Length of output: 165


🏁 Script executed:

find . -type f -name "Layout.axaml*" | head -5

Repository: TeamWheelWizard/WheelWizard

Length of output: 139


🏁 Script executed:

cat -n ./WheelWizard/Views/Components/StateBox.axaml

Repository: TeamWheelWizard/WheelWizard

Length of output: 9504


🏁 Script executed:

cat -n ./WheelWizard/Views/Components/StateBox.axaml.cs

Repository: TeamWheelWizard/WheelWizard

Length of output: 3895


🏁 Script executed:

sed -n '199,218p' ./WheelWizard/Views/Layout.axaml.cs

Repository: TeamWheelWizard/WheelWizard

Length of output: 868


🏁 Script executed:

sed -n '71,75p' ./WheelWizard/Views/Layout.axaml

Repository: TeamWheelWizard/WheelWizard

Length of output: 458


🏁 Script executed:

sed -n '65,80p' ./WheelWizard/Views/Layout.axaml

Repository: TeamWheelWizard/WheelWizard

Length of output: 1009


Use the TipText property instead of ToolTip.SetTip(); direct attached property setting bypasses the template binding.

The StateBox template binds its internal Border's ToolTip.Tip to the TipText property via TemplateBinding (StateBox.axaml:30). Calling ToolTip.SetTip() on the StateBox instance sets the attached property on the control itself, but the Border (which renders the tooltip) only reads from TipText. Setting StateBox.ToolTip.Tip has no effect on what displays.

Assign to TipText directly instead:

🔧 Proposed fix
         PlayerCountBox.Text = playerCount.ToString();
-        ToolTip.SetTip(
-            PlayerCountBox,
-            playerCount switch
-            {
-                1 => Phrases.Hover_PlayersOnline_1,
-                0 => Phrases.Hover_PlayersOnline_0,
-                _ => Humanizer.ReplaceDynamic(Phrases.Hover_PlayersOnline_x, playerCount)
-                    ?? $"There are currently {playerCount} players online",
-            }
-        );
+        PlayerCountBox.TipText = playerCount switch
+        {
+            1 => Phrases.Hover_PlayersOnline_1,
+            0 => Phrases.Hover_PlayersOnline_0,
+            _ => Humanizer.ReplaceDynamic(Phrases.Hover_PlayersOnline_x, playerCount)
+                ?? $"There are currently {playerCount} players online",
+        };
         RoomCountBox.Text = roomCount.ToString();
-        ToolTip.SetTip(
-            RoomCountBox,
-            roomCount switch
-            {
-                1 => Phrases.Hover_RoomsOnline_1,
-                0 => Phrases.Hover_RoomsOnline_0,
-                _ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) ?? $"There are currently {roomCount} rooms active",
-            }
-        );
+        RoomCountBox.TipText = roomCount switch
+        {
+            1 => Phrases.Hover_RoomsOnline_1,
+            0 => Phrases.Hover_RoomsOnline_0,
+            _ => Humanizer.ReplaceDynamic(Phrases.Hover_RoomsOnline_x, roomCount) 
+                ?? $"There are currently {roomCount} rooms active",
+        };

Also remove the ToolTip.Tip bindings in Layout.axaml (lines 71, 75) on both StateBox elements and rely solely on TipText assignments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@WheelWizard/Views/Layout.axaml.cs` around lines 199 - 218, The code currently
uses ToolTip.SetTip(...) on PlayerCountBox and RoomCountBox which sets the
attached ToolTip property on the control but is ignored by the StateBox template
that reads TipText via TemplateBinding; replace the ToolTip.SetTip calls by
assigning the computed strings to the TipText property on the StateBox instances
(e.g. PlayerCountBox.TipText = ... and RoomCountBox.TipText = ... using the same
playerCount/roomCount switch logic) and remove the ToolTip.Tip bindings from the
StateBox elements in the layout so the template-bound Border reads the new
TipText values.

UpdateFriendCount();
}

Expand Down