gpt4 book ai didi

c# - Windows Phone 列表框在平移时闪烁

转载 作者:可可西里 更新时间:2023-11-01 10:48:48 26 4
gpt4 key购买 nike

我在平移 Panorama 应用程序时遇到一些闪烁问题,列表框开始闪烁,如您在此视频中所见: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>

这是绑定(bind)的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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com