Skip to content

fix: SelectedIndex binding for Platform/AppType ComboBox#39

Merged
JusterZhu merged 1 commit into
mainfrom
fix/selectedindex-binding
May 20, 2026
Merged

fix: SelectedIndex binding for Platform/AppType ComboBox#39
JusterZhu merged 1 commit into
mainfrom
fix/selectedindex-binding

Conversation

@JusterZhu
Copy link
Copy Markdown
Collaborator

Fix ComboBox InvalidCastException by using SelectedIndex instead of SelectedItem.

Root cause: Avalonia ComboBox SelectedItem binding struggles with complex types (reference equality mismatch, TypeConverter interference).

Fix:

  • Config.Platform/AppType stay as int (1/2)
  • New PlatformIndex/AppTypeIndex properties map int ↔ index bidirectionally
  • XAML binds SelectedIndex, not SelectedItem → zero type conversion

Build: 0 errors

… conversion)

- Config.Platform/AppType back to int (1=Windows, 2=Linux; 1=ClientApp, 2=UpgradeApp)
- Add PlatformIndex/AppTypeIndex computed properties mapping int ↔ index
- XAML: SelectedIndex binding instead of SelectedItem
- No reference equality or type conversion issues
Copilot AI review requested due to automatic review settings May 20, 2026 15:45
@JusterZhu JusterZhu merged commit d3dfccb into main May 20, 2026
1 check failed
@JusterZhu JusterZhu deleted the fix/selectedindex-binding branch May 20, 2026 15:46
@JusterZhu JusterZhu review requested due to automatic review settings May 20, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant