Last autumn Microsoft allowed gifting of certain digital Xbox games via their store, as well as DLC, Gold subscriptions, and Game Pass subscriptions, and now they've announced that they've expanded digital gifting to include PC games and DLC, as well as revealing that all Xbox One games are now available for digital gifting.
To do this on PC you'll need to head over to the Microsoft Store, select the product, choose 'Buy as Gift', and then enter the email address of the person you want to receive it (on Xbox One, though, you can choose a Gamertag, which might make things slightly easier). This person then receives a code as well as instructions on how to redeem the item, while Xbox One users will receive a system message with a redemption button.
It's worth noting a few things though, as summarised on Microsoft's site:
Microsoft asks that players give feedback on the new system, including features they'd like to see, but for now it looks promising for you benevolent souls out there. Is this a welcome feature in your eyes?