Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot change access modifiers when overriding 'protected' inherited member 'Windows.UI.Xaml.FrameworkElement.OnApplyTemplate() Error In Wp8.1 WinRt

This Code is Working in WP8.0 but in WP8.1 Universal Apps i got the error.

 public override void OnApplyTemplate()
 {
      base.OnApplyTemplate();
      //Some Statements
 }

Exception

Cannot change access modifiers when overriding 'protected' inherited member 'Windows.UI.Xaml.FrameworkElement.OnApplyTemplate()

like image 539
Devi Prasad Avatar asked Dec 12 '22 00:12

Devi Prasad


1 Answers

"Error CS0507 can also occur if a class attempts to override a method marked as protected internal defined in referenced metadata. In this situation, the overriding method should be marked as protected."

  • Source: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0507

So, just simply remove the "internal" keyword from your overriding method, and keep it only "protected".

like image 89
Dániel László Kovács Avatar answered Jan 31 '23 13:01

Dániel László Kovács