RolandJS
RolandJS

Reputation: 1035

Error CS1061 '...Page...' does not contain a definition for 'InitializeComponent'

Get Compilation error

"Error CS1061: '...Page...' does not contain a definition for 'InitializeComponent' and no accessible extension method 'InitializeComponent' accepting a first argument of type '...Page ...' could be found (are you missing a using directive or an assembly reference?)"

The line this.InitializeComponent(); is marked with a red line.

See my own answer.

Upvotes: 1

Views: 144

Answers (1)

RolandJS
RolandJS

Reputation: 1035

If you have copied a page (.XAML) into your project with 'Add'.'Existing Item...', the property 'Build Action' for the .XAML file is probably set to 'None', it should be 'Page'.

Upvotes: 1

Related Questions