TabItem Render
-
I'd like to load a TabItems's content async. What would be nice is to see the Tab Item added to the TabControl, then do the async load while a spinning indicator is running. Something like ContentRendered would do, but I don't see anything like it on the TabItem. Anyone know of a way to do this?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
I'd like to load a TabItems's content async. What would be nice is to see the Tab Item added to the TabControl, then do the async load while a spinning indicator is running. Something like ContentRendered would do, but I don't see anything like it on the TabItem. Anyone know of a way to do this?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
When I do this type of thing, I use MVVM and have a state represent the loaded nature; the visibility of the spinner animation is bound to the loaded state.
-
When I do this type of thing, I use MVVM and have a state represent the loaded nature; the visibility of the spinner animation is bound to the loaded state.
Let me clarify my question... I'm not asking about the indicator... 1. Tab appears. 2. Spinning indicator appears 3. Call GetData 4. Data is returned 5. Tab's content is loaded 6. Indicator goes away. The problem is that I want to show a blank tab first, then start the process of getting the data. But where do you start it from? There doesn't seem to be a ContentRedered or Loaded or Initialized event to kick off the async data call after the tab is visible
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Let me clarify my question... I'm not asking about the indicator... 1. Tab appears. 2. Spinning indicator appears 3. Call GetData 4. Data is returned 5. Tab's content is loaded 6. Indicator goes away. The problem is that I want to show a blank tab first, then start the process of getting the data. But where do you start it from? There doesn't seem to be a ContentRedered or Loaded or Initialized event to kick off the async data call after the tab is visible
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
I can't tell whether you are using MVVM or not from your question. If I were doing this, I would adopt a slightly different approach; I would bind the tabs to an ObservableCollection. When I instantiate my new tab and add it to the collection, I would trigger the async load. In other words, I disconnect the state from the visual. I don't need to worry about tracking tab states because this is automatically connected to my ViewModel.
-
Let me clarify my question... I'm not asking about the indicator... 1. Tab appears. 2. Spinning indicator appears 3. Call GetData 4. Data is returned 5. Tab's content is loaded 6. Indicator goes away. The problem is that I want to show a blank tab first, then start the process of getting the data. But where do you start it from? There doesn't seem to be a ContentRedered or Loaded or Initialized event to kick off the async data call after the tab is visible
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
TabItem inherits from FrameworkElement and therefore has a "Loaded" event.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I