Я создал следующий вид XAML:ListView в Pivot не может быть заселена
<Page
x:Class="Phone.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PhoneMetar"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="LayoutRoot">
<Pivot Title="Pivot Title">
<PivotItem Header="first option">
<Grid>
</Grid>
</PivotItem>
<PivotItem Header="second option">
<Grid>
</Grid>
</PivotItem>
<PivotItem Header="settings">
<Grid>
<ListView x:Name="LVSettings" ItemsSource="{Binding SettingsDict}">
</ListView>
</Grid>
</PivotItem>
</Pivot>
</Grid>
</Page>
А в коде позади, при попытке создать свой ListView «LVSettings», я не могу получить доступ к нему. Я пытаюсь заполнить его
public static Dictionary<string, string> SettingsDict { get; set; }
public static void CreateSettingsList()
{
SettingsDict = new Dictionary<string, string>();
SettingsDict.Add("auto download", (Settings.DownloadTimer == true) ? "enabled" : "disabled");
SettingsDict.Add("download timer", Settings.DownloadInterval.ToString() + " minutes");
ListView LVSettings = new ListView();
LVSettings.ItemsSource = SettingsDict;
LVSettings.SelectionChanged += LVSettings_SelectionChanged;
}
Я попробовал несколько примеров, и даже при создании новой страницы XAML без шарниров я могу сделать эту работу ListView, так что должно быть что-то здесь не так, что я не могу определить.
Вы бы так любезны указать мне в правильном направлении? Спасибо.