In one embodiment, an intramedullary nail has a body that includes proximal and distal ends and an inner surface that defines at least one locking hole that extends into an outer surface of the body so as to receive a bone anchor to lock the nail in a medullary canal of a bone. The body has a first biocompatible material that defines at least a portion of the outer surface. The nail has a second material that is different from, and at least partially encapsulated in, the first material. The second material can produce at least one of an electrical current and a magnetic field, and is supported by the nail body such that a position of the at least one bone-anchor locking hole can be detected based on the at least one of the electrical current and the magnetic field.