View Issue Details

IDProjectCategoryView StatusLast Update
0004571NoesisGUIStudiopublic2025-11-25 17:13
Reporterdstewart Assigned Tosfernandez  
PrioritynormalSeverityminor 
Status assignedResolutionopen 
Product VersionStudio_Beta 
Target VersionStudio_Beta 
Summary0004571: ListBox's SelectedIndex Reverts to -1 in Studio When The Input Value Exceeds the Count Of The Data Collection
Description

Currently, if the SelectedIndex of the ListBox exceeds the Count of the DataSet, it is not possible to manually input this value, and Studio will revert it to "-1".
This occurs even if the value is correctly logged and recorded in the XAML itself.

See attached video, where the SelectedIndex field is clicked-and-dragged, and resets after the mouse is released (after momentarily showing a Data Value).


Repro Steps:

1) Create a Studio Project featuring a MainPage.xaml

2) From the Data Panel, create a DataStructure named "MyStructure", containing a DataProperty of name "MyString", of type 'String', and set to be served as a 'Single'.

3) From the Data Panel, create a second DataStructure named "MyViewModel" containing a DataProperty of name "MyCollection" and of type "MyStructure" (referencing the Structure created in Step 2), and set to be served as a 'Collection'.

4) From the Data Panel, create a Data Set called "MyDataSet' from the "MyViewModel" Structure, apply it to the Page, and generate Sample/Random Data for its contents.

5) Introduce a ListBox to the RootGrid of the Page, and set its 'ItemSource' Property to be bound to the "MyCollection" of the Data Context.

6) Right-Click on the ListBox on Stage, and create a new Template for its ListBox Item Template from its Context Menu, saved to the GlobalResources.
This will open the ListBox Item Template in the Dummy Editor.

7) Inside of the ListBox Item Dummy Editor, select the TextBlock in the Navigator, and in its Properties, adjust its Binding to link to the 'MyString' Data Property of the DataContext.

8) Press the 'Home' icon in the upper-left of the ListBox Item Template's Dummy Editor to return to the Page.

9) At this point, due to https://www.noesisengine.com/bugs/view.php?id=4570 , save all Documents, and close-and-re-open MainPage.xaml to see the Bindings and the SelectedItem appear correctly in the ListBox.

10) Select the ListBox, and from its Properties, either input, or click-and-drag a value in its 'SelectedIndex' field that exceeds the amount of items in the Collection (For example, if 10 items are in the DataSet, set a number exceeding 11)

Observe how the value 'snaps' back to "-1"

11) Save all open documents, and open MainPage.xaml in VSCode, and find the ListBox.

Observe how in the XAML, the SelectedIndex value corresponds to the value that was manually set, and not the "-1" displayed by Studio.

Expected Results: Studio displays the SelectedIndex set by the user, even if the SelectedIndex is outside of the count of the item count in the Design-Time Data.

Attached Files
PlatformAny

Activities

sfernandez

sfernandez

2025-11-24 18:08

manager   ~0011460

That is the expected behavior, when the index is outside the range of items it gets coerced to -1.

dstewart

dstewart

2025-11-25 17:13

developer   ~0011466

I think the challenge I possibly see with this, is the following:

1) It creates a situations where it renders null outputs by default.
What if for example, instead of coercing to -1, if the Index is above the Count, it instead goes to the last item in the array?

2) What happens if you set a DesignTime Index that is meant to serve a Runtime index.
For example: Maybe you have 16 Items in Design time, but 32 in the Runtime Data.
If you then set the Index to be "32", it would coerce to -1.

Would coercing to -1 would mean that it would get coerced at Runtime even if the user manually asked it to be "32"?

(Just some thoughts I had in considering this a 'bug')

Issue History

Date Modified Username Field Change
2025-11-24 17:47 dstewart New Issue
2025-11-24 17:47 dstewart File Added: 2025-11-24 08-05-11.mp4
2025-11-24 18:08 sfernandez Assigned To => sfernandez
2025-11-24 18:08 sfernandez Status new => feedback
2025-11-24 18:08 sfernandez Note Added: 0011460
2025-11-25 11:22 jsantos Target Version => Studio_Beta
2025-11-25 17:13 dstewart Note Added: 0011466
2025-11-25 17:13 dstewart Status feedback => assigned