Reputation: 89
I'm Developing windows phone 8.1 application when i want to start emulator Give me this error "Type expected" line 27 this is the line of code:
statusBar.BackgroundColor = new ((SolidColorBrush)Windows.UI.Xaml.Application.Current.Resources["PhoneAccentBrush"]);
`
Upvotes: 0
Views: 3724
Reputation: 28528
Error is clear, you are not telling the type name:
statusBar.BackgroundColor = new (...);
-------^
Now, you've got a SolidColorBrush
(after casting) but you're trying to get a Color
. Fortunately, SolidColorBrush
has a Color
property which is what I suspect you want:
var brush = (SolidColorBrush) Application.Current.Resources["PhoneAccentBrush"];
statusBar.BackgroundColor = brush.Color;
Upvotes: 2
Reputation: 1499760
You're trying to use the new
operator, which requires a type, like this:
variable = new SomeType(constructorArguments);
You've got new
and then a cast.
I suspect you just want the cast, without new
:
// With a using directive for Windows.UI.Xaml...
statusBar.BackgroundColor = (SolidColorBrush) Application.Current.Resources["PhoneAccentBrush"];
Upvotes: 0