WPF - creating content for a tabitem dynamically
-
12-09-2019 - |
Question
I'd like to set the content of a tabitem dynamically, based on the content/actions taken on previous tabitems.
I'm advancing through the tabs via a command like:
tabControl1.SelectedIndex++;
However, the Loaded event doesn't get fired after this like I thought it would. tabControl1_SelectionChanged() is getting called, however. Should I manually call the tabitem's Load() event from SelectionChanged(), or is there a better way of doing this?
Solution
Load will get called only once for every TabItem. but you can get the required TabItem instance from the SelectionChanged and set its content
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow