Magic staves can have weapon runes applied to them. One rune is a Shifting rune, which lets you transform the weapon into a different weapon. If I use a Shifting rune to transform a staff into a Gauntlet, then pick up a sword with that hand, can I still cast spells from the staff/gauntlet in this state?
You might not be able to turn a staff into a gauntlet.
The Shifting rune includes the description
With a moment of manipulation, you can shift this weapon into a different weapon with a similar form.
While the other text is simply "another melee weapon that requires the same number of hands", some GM's may consider a gauntlet too removed from other melee weapons to be a valid Shifting choice.
You also probably can't use the "staff" gauntlet while the hand is occupied.
Casting a Spell from a staff requires holding the staff (typically in one hand) and Activating the staff by Casting the Spell
Of course, this is small enough that many GM's will allow this interesting use of the weapon ability. There doesn't seem to be a rule specifically about this interaction.