View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001751||NoesisGUI||C# SDK||public||2020-07-07 14:40||2020-07-09 13:54|
|Target Version||3.0.3||Fixed in Version||3.0.3|
|Summary||0001751: TabControl selection issue|
I have an odd bug with TabControl that took me over 2 hours to investigate.
It seems when I change the active tab by ANY way (e.g. tabControl.SelectedIndex, or SelectedItem, or through tabItem.IsSelected Binding), visually everything is changed as expected. However, the previously selected tab cannot be clicked. No effect until I manually click on any other tab to move the select, then I'm able to click on the previously selected tab. It seems there is something odd going on in the TabControl internal state. See the steps to reproduce.
|Steps To Reproduce||1. create tab control with two tabs|
2. make that second tab is selected programmatically by some action
3. start application, select first tab. Perform action to select second tab.
4. try to select the first tab. Selection doesn't change!
I guess TabControl internal state assumes that the first tab is still selected.
A workaround is simple and 100% efficient—just reset the visual state of the tab control when its selected tab is changed:
this.tabControl.Visibility = Visibility.Collapsed; this.tabControl.UpdateLayout(); this.tabControl.Visibility = Visibility.Visible;
|Tags||No tags attached.|
Maybe I'm missing something, but the tests I'm doing using bindings are working: https://www.noesisengine.com/xamltoy/e6d84aa593deb24eaf275bd77c38dc6b
Anything different from your scenario in that test?
I'm not sure if it's possible to reproduce this bug only with XAML.
The issue involves programmatically (in C# codebehind) changing the selected tab (either via TabControl SelectedIndex or by TabControl SelectedItem, or by changing TabItem IsSelected property) as I've mentioned in the steps to reproduce.
I can also reproduce the issue with MVVM data binding but I was able to isolate it to just C# codebehind code that changes SelectedIndex of the tab control.
I've investigated whether it might be style/template-related but it seems to be not the case.
|Do the tabs need to be generated from data to reproduce the issue, or can they be TabItems defined in the xaml?|
The TabItems are defined in XAML.
|2020-07-07 14:40||ai_enabled||New Issue|
|2020-07-08 11:27||jsantos||Assigned To||=> sfernandez|
|2020-07-08 11:27||jsantos||Status||new => assigned|
|2020-07-08 11:27||jsantos||Target Version||=> 3.0.3|
|2020-07-08 18:09||sfernandez||Status||assigned => feedback|
|2020-07-08 18:09||sfernandez||Note Added: 0006517|
|2020-07-08 18:13||ai_enabled||Note Added: 0006518|
|2020-07-08 18:13||ai_enabled||Status||feedback => assigned|
|2020-07-08 18:13||ai_enabled||Note Edited: 0006518||View Revisions|
|2020-07-08 18:15||ai_enabled||Note Edited: 0006518||View Revisions|
|2020-07-08 18:16||ai_enabled||Note Edited: 0006518||View Revisions|
|2020-07-08 18:17||ai_enabled||Note Added: 0006519|
|2020-07-08 18:36||sfernandez||Status||assigned => feedback|
|2020-07-08 18:36||sfernandez||Note Added: 0006520|
|2020-07-08 19:53||ai_enabled||Note Added: 0006522|
|2020-07-08 19:53||ai_enabled||Status||feedback => assigned|
|2020-07-08 19:53||ai_enabled||Note Edited: 0006522||View Revisions|
|2020-07-09 13:54||sfernandez||Status||assigned => resolved|
|2020-07-09 13:54||sfernandez||Resolution||open => fixed|
|2020-07-09 13:54||sfernandez||Fixed in Version||=> 3.0.3|