我在摇摄全景应用程序时出现闪烁问题,列表框开始闪烁,如您在本视频中所见: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;
}
更新:如果应用程序条模式设置为“最小化”,闪烁问题将消失,如果我将其设置为“默认”模式,闪烁将再次开始,有人知道为什么会这样吗?如果有可能的话。
最佳答案
解决方案:看起来不透明性是罪魁祸首,我没有使它成为固体,而是将不透明性设置为.99,工作没有任何问题。
关于c# - 平移时Windows Phone列表框闪烁,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13012363/