我在平移全景应用程序时遇到了一些闪烁问题,列表框开始闪烁,您可以在此视频中看到:http ://www.screenr.com/Aiy8
XAML 代码:
<phone:PhoneApplicationPage
x:Class="PanoramaApp5.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True" shell:SystemTray.BackgroundColor="Transparent"
shell:SystemTray.Opacity="0">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Panorama control-->
<controls:Panorama FontSize="20" Foreground="White" Loaded="Panorama_Loaded" Title="Envato Stats" Background="{x:Null}">
<controls:Panorama.TitleTemplate>
<DataTemplate>
<Image Source="/PanoramaApp5;component/Images/logo.png" Margin="14,105,0,10" HorizontalAlignment="Left" Name="logo" Stretch="Fill" VerticalAlignment="Top" Width="700" Height="70"/>
<!--<TextBlock Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" FontSize="100" Margin="10,50,0,0" />-->
</DataTemplate>
</controls:Panorama.TitleTemplate>
<controls:PanoramaItem Header="recent sales" Margin="0,-20,0,0">
<!--Double line list with image placeholder and text wrapping-->
<ListBox Margin="0,0,-12,0" ItemsSource="{Binding Items}" Width="435" Height="Auto">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,17">
<StackPanel Width="auto" MaxWidth="440">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextLargeStyle}" />
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,1,12,0" Style="{StaticResource PhoneTextSubtleStyle}" />
<TextBlock Text="{Binding LineThree}" TextWrapping="Wrap" Margin="12,1,12,0" Style="{StaticResource PhoneTextSubtleStyle}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
</controls:Panorama>
</Grid>
</phone:PhoneApplicationPage>
这是用于绑定的 C# 代码
public void LoadRecent(object sender, DownloadStringCompletedEventArgs e)
{
try // In case the user is blocked by the API
{
XDocument document = XDocument.Parse(e.Result);
// Get the XML nodes
IEnumerable<XElement> item =
from el in document.Descendants("item")
select el;
IEnumerable<XElement> amount =
from el in document.Descendants("amount")
select el;
IEnumerable<XElement> rate =
from el in document.Descendants("rate")
select el;
IEnumerable<XElement> soldAt =
from el in document.Descendants("sold-at")
select el;
int i = 0;
foreach (XElement el in document.Descendants("amount"))
{
DateTime mydate = DateTime.ParseExact(soldAt.ElementAt<XElement>(i).Value, "ddd MMM dd HH:mm:ss zzz yyyy", System.Globalization.CultureInfo.InvariantCulture);
this.Items.Add(new ItemViewModel() { LineOne = item.ElementAt<XElement>(i).Value, LineTwo = "Amount: $" + amount.ElementAt<XElement>(i).Value + string.Format(" at the rate {0:P0}", float.Parse(rate.ElementAt<XElement>(i).Value)), LineThree = soldAt.ElementAt<XElement>(i).Value });
i++;
}
}
catch { }
this.IsDataLoaded = true;
}
更新:似乎如果应用程序栏模式设置为“最小化”闪烁问题消失,如果我将其设置为“默认”模式闪烁再次开始,任何人都有任何线索为什么会这样?如果有可能修复它。