You need to start working more with Visual Studio: teh error is not in that code. If I create a new WPF app project and paste that code into the MainWindows.xaml.cs file, the only errors I get refer to controls I don't have:
Rectangle1.Fill = brush1;
header_block.Fill = brush2;
There is no mention of a "method name expected" error at all, and providing controls with matching names won't cause it either.
So start by double clicking the error message in the Errors pane, and VS will take you directly to the line. Look closely at it, and the parts with the red underline, and also examine the code immediately above it. It may be you have forgotten a semicolon, or close bracket of some kind - we can't tell.
But it isn't in that code.