I have a WPF application that I need to move to a tray. It currently starts directly in the UI, and there are two tabs. On the second tab, there are a couple collapsible containers that hold settings for associated devices. Devices can be added or removed dynamically.
I have added the tray app, and added code to call the settings from the app. Everything works properly except the collapsible containers are empty. I’ve traced the code to confirm that they should have objects in them.
I find it odd that they work if I set the default application to the UI, but they do not work when starting the UI from the tray. I have included a section of the xaml below:
<c:CollapsibleSection Header="Senders">
<c:CollapsibleSection.CollapsedContent>
<c:RepeatControl Margin="30,0,0,0" ItemsSource="{Binding SendersList}"
ItemType="{x:Type m:Sender}" List="{Binding SendersList}"
ItemTemplate="{StaticResource SenderSummary}"/>
</c:CollapsibleSection.CollapsedContent>
<Border BorderThickness="1" BorderBrush="Chocolate" Margin="30,0,0,0">
<c:RepeatControl ItemsSource="{Binding SendersList}" ItemType="{x:Type m:Sender}" List="{Binding SendersList}" ItemTemplate="{StaticResource SenderTemplate}"/>
</Border>
</c:CollapsibleSection>
I am not very familiar with WPF, and was wondering if there was a good method for debugging the xaml in VS 2008. I have found tools in 2010 and 2012, and a few old posts for 2005 that give basic work-arounds, but am not finding much on 2007.
I am also hopeful that someone might know what might cause it to work properly when the UI is started as the Startup Project, but not when being called from another project. The project was initially developed as the UI being the Startup Project, and the tray is a separate project, if that helps any. The UI is also made up of several classes that reside in both the main project folder and a UI folder. However, it seems that all xaml is being accessed (other parts of the class that has the CollapsibleSection are created).
There are no exceptions thrown.
ADDITIONAL INFORMATION
I also tried adding a test-textblock to see if unbound text would appear in a sender, but still nothing displayed. The added code is below:
<TextBlock Name="testTextBlock">
<ContentControl Content="This is just a test... " Foreground="Red">/ContentControl>
</TextBlock>
Thanks for any assistance.
I finally figured this one out. Instead of instantiating the UI, the entire WPF application must be called to run. This will cause the App.xaml to load the dictionary, and other WPF forms can then access it. This is done with the following code:
This was discovered through experimentation, so i am sure it is not the best practice, but it works, and right now, that was what I needed.
Thank you, Blam, for your contributions! I did find them helpful.