[Tex/LaTex] Changing only the header for Table of Contents pages with package fancyhdr

fancyhdrheader-footertable of contents

I want to make my Table of Contents pages show "Table of Contents" in their headers with package fancyhdr. Right now, according to the MWE below, this is what it shows:
enter image description here

And this is what I want it to show:
enter image description here
The header, in this case, was done via \fancyhead[RE,LO]{Table of Contents}. This affects all other pages though, which is definitely not what I want.

Below is my MWE:

\documentclass[10pt,openany]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
    \fancyhf{}
    \fancyhead[RE,LO]{Part \thepart\enspace--\enspace Chapter \thechapter}
    \fancyhead[LE,RO]{\thepage}
    \fancyfoot[C]{My Book}

\begin{document}
\tableofcontents
\part{One}
\chapter{1}
\chapter{2}
\part{Two}
\chapter{3}
\chapter{4}
\chapter{5}
\chapter{6}
\chapter{7}
\part{Three}
\chapter{8}
\chapter{9}
\chapter{10}
\chapter{11}
\chapter{12}
\part{Four}
\chapter{13}
\chapter{14}
\part{Five}
\chapter{15}
\chapter{16}
\chapter{17}
\chapter{18}
\chapter{19}
\chapter{20}
\part{Six}
\chapter{21}
\chapter{22}
\chapter{23}
\chapter{24}
\end{document}

EDIT: My environment is MikTeX 2.9 and Command-Line pdflatex (with the help of Neovim) on Windows 10.

MORE EDIT: I want to be able to change the stuff that goes in the header/footer, so even though \pagestyle{fancy} does print TABLE OF CONTENTS for ToC pages, I'd like to avoid that option unless absolutely necessary.

Best Answer

Well, you can for example define two own styles to be used:

\fancypagestyle{styletoc}{% <===========================================
  \fancyhf{}
  \fancyhead[RE,LO]{Table of contents}
  \fancyhead[LE,RO]{\thepage}
  \fancyfoot[C]{My Book}
% \renewcommand{\headrulewidth}{0pt}
}

\fancypagestyle{stylenor}{% <===========================================
  \fancyhf{}
  \fancyhead[RE,LO]{Part \thepart\enspace--\enspace Chapter \thechapter}
  \fancyhead[LE,RO]{\thepage}
  \fancyfoot[C]{My Book}
% \renewcommand{\headrulewidth}{0pt}
}

Style styletoc is then only used for the table of contents part, style stylenor for the other parts. Please sse that you should also define a new style plain:

\fancypagestyle{plain}{% <===========================================
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
} 

to get rid of the headrule without any other datas and the standard page number in the center of the footer ...

With the following mwe

\documentclass[10pt,openany]{book}

\usepackage{blindtext}
\usepackage{fancyhdr}

\fancypagestyle{styletoc}{% <===========================================
  \fancyhf{}
  \fancyhead[RE,LO]{Table of contents}
  \fancyhead[LE,RO]{\thepage}
  \fancyfoot[C]{My Book}
% \renewcommand{\headrulewidth}{0pt}
}

\fancypagestyle{stylenor}{% <===========================================
  \fancyhf{}
  \fancyhead[RE,LO]{Part \thepart\enspace--\enspace Chapter \thechapter}
  \fancyhead[LE,RO]{\thepage}
  \fancyfoot[C]{My Book}
% \renewcommand{\headrulewidth}{0pt}
}

\fancypagestyle{plain}{% <===========================================
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
}


\begin{document}

\pagestyle{styletoc} % <================================================
\tableofcontents

\part{One}
\pagestyle{stylenor} % <================================================
\chapter{1}
\Blindtext
\chapter{2}
\part{Two}
\chapter{3}
\chapter{4}
\chapter{5}
\chapter{6}
\chapter{7}
\part{Three}
\chapter{8}
\chapter{9}
\chapter{10}
\chapter{11}
\chapter{12}
\part{Four}
\chapter{13}
\chapter{14}
\part{Five}
\chapter{15}
\chapter{16}
\chapter{17}
\chapter{18}
\chapter{19}
\chapter{20}
\part{Six}
\chapter{21}
\chapter{22}
\chapter{23}
\chapter{24}
\end{document}

you get the following wished result:

enter image description here

and for chapter 1 etc:

enter image description here