Here's a quick (untested) adaption of your code to integrate a call to my LM:listbox function:
(defun c:formatxr ( / cmd def lst )
(while (setq def (tblnext "block" (not def)))
(if (= 4 (logand 4 (cdr (assoc 70 def))))
(setq lst (cons (cdr (assoc 2 def)) lst))
)
)
(if lst
(progn
(setq cmd (getvar 'cmdecho))
(setvar 'cmdecho 0)
(foreach xrf (LM:listbox "Select Xrefs to Format" (acad_strlsort lst) 1)
(command
"_.-layer"
"_color" 252 (strcat xrf "|*")
"_pstyle" "Shade 50%" (strcat xrf "|*")
"_color" 150 (strcat xrf "|C-PVMT-ASPH," xrf "|C-PVMT-CONC," xrf "|C-PVMT-GRVL")
"_freeze" (strcat xrf "|X-TOPO-TEXT")
""
)
)
(setvar 'cmdecho cmd)
)
(princ "\nNo xrefs are defined in the active drawing.")
)
(princ)
)