I am beginner in WPF. My App.xaml looks like below
app.xaml
<Application x:Class="ContactManager.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<Color x:Key="lightBlueColor">#FF145E9D</Color>
<SolidColorBrush x:Key="lightBlueBrush"
Color="{StaticResource lightBlueColor}" />
</Application.Resources>
I do not set the startupuri since I want to a presenter first approach. I do the following in app.xaml.cs
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var appPresenter = new ApplicationPresenter(
new Shell(), new ContactRepository());
appPresenter.LaunchView();
}
I have a usercontrol called "SearchBar.xaml" which references "lightBlueBrush" as a staticResource.
When I try to open "Shell.xaml" in the designer it tells me : The "shell.xaml" cannot be loaded at design time because it says it could not create an instance of type "SearchBar.xaml".
When I debugged the devenv.exe using another visual studio instance it tells me that it does not have access to the Brush I created in app.resources.
If one is doing a Presenter first approach, how does one access resources?
I had this working when the startupURI was "Shell.xaml" and the startup event was not present.
Any clues/ideas/suggestions. I am just trying to understand.
Everything works as expected when I run the application just not @ design time.