Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. TabItem Render

TabItem Render

Scheduled Pinned Locked Moved WPF
helpquestion
5 Posts 3 Posters 15 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    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.

    P 1 Reply Last reply
    0
    • K Kevin Marois

      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.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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.

      Advanced TypeScript Programming Projects

      K 1 Reply Last reply
      0
      • P Pete OHanlon

        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.

        Advanced TypeScript Programming Projects

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        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.

        P L 2 Replies Last reply
        0
        • K Kevin Marois

          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.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          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.

          Advanced TypeScript Programming Projects

          1 Reply Last reply
          0
          • K Kevin Marois

            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.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups