...
in the code I am looking at on windows the wrapper just uses
System.Security.Cryptography.SHA256 and does a double hash and I can see that the public key
gets used to to create a signature along with the double hash so how does this work ?
In bitcoin all keys are managed by ECDSA logic, and I would hope, that the code to create the signatures (also in the windows systems) use the
private key.

On the tx and the signature: there is a fairly complex process to create the tx (see answer from runeks here:
http://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx), and then this tx is hashed (sha256), and this hash is signed.