How does this happen?
It happens at the level of meaning-making, how we construe, interpret, and make sense of the world. Cognitively, dispositions are controlled in a top-down fashion. Dispositions, we might say, dictate our emotional responses to external events rather than our being reactive to and triggered by circumstance.
For example, in The Shape of Joy I use Robert Robert's description of joy as a "concern-based construal." Joy can be a positive emotion, an experience of gladness and delight in response to some happy event. But dispositional joy, joy as a virtue, is more consistent, stable, and enduring. And most importantly, dispositional joy creates capacities for joy even in difficult circumstances. In The Shape of Joy I make a contrast between triggered joy (joy as emotion) versus transcendent joy (joy as disposition). This triggered-to-transcending shift happens, following Roberts, by noting how joy is a construal, a way of seeing and perceiving the world. Joy as a process of meaning-making. And continuing with Roberts, this meaning-making process is "concern-based," having to do with our cares, values, and investments. As I put it in The Shape of Joy, joy is seeing the world through what you care about.
Knowing this about joy we have two levers to pull. First, there is perceptual work, how we see and interpret the world. We can change or alter our perspective. We can reframe and reconsider. Second, we have control over our concerns, where we invest and place the weight of our lives. We can locate our concerns in places that provide deeper and more constant anchorage in the storms of life. As Jesus says:
Don’t store up for yourselves treasures on earth, where moth and rust destroy and where thieves break in and steal. But store up for yourselves treasures in heaven, where neither moth nor rust destroys, and where thieves don’t break in and steal. For where your treasure is, there your heart will be also.