Based on what I could glean from Freeman's book "Metro Revealed" (which, BTW, is the best of those available so far, albeit weighing in at less than 100 pages), I'm trying to implement a settings flyout (popup).
I have this pertinent code:
The user control that has/is the popup:
<UserControl
x:Class="TimeAndSpaceLines.View.TSLsSettings"
. . .
<Popup x:Name="popupSectionName" IsLightDismissEnabled="True" >
. . .
</Popup>
</UserControl>
The "main" page's xaml:
<common:LayoutAwarePage
x:Name="pageRoot"
. . .
xmlns:settingsflyout="using:TimeAndSpaceLines.View"
. . .
</Grid>
<settingsflyout:TSLsSettings x:Name="hubPageSettingsFlyout"/>
<VisualStateManager.VisualStateGroups>
. . .
The "main" page's pertinent "code-behind":
public ItemsPage()
{
InitializeComponent();
SettingsPane.GetForCurrentView().CommandsRequested += OnSettingsPaneCommandRequested;
}
private void OnSettingsPaneCommandRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
// Add the commands one by one to the settings panel
args.Request.ApplicationCommands.Add(new SettingsCommand("commandSetSection1Name",
"Change the name of Section 1", SetAndSaveSectionNames));
. . .
}
However, when I try to open it this way:
private void SetAndSaveSectionNames(IUICommand command)
{
TimeAndSpaceLines.View.TSLsSettings.popupSectionName.IsOpen = true;
. . .
}
I'm greeted with:
An object reference is required for the non-static field, method, or property
'TimeAndSpaceLines.View.TSLsSettings.popupSectionName'
and:
'TimeAndSpaceLines.View.TSLsSettings.popupSectionName' is inaccessible due to its protection level
Yet popupSectionName
is not a class, and the class in which it resides is public. What should I do?