This question is locked. New answers and comments are not allowed.
Hello, I'm having an issue with the Gauge controls.
I have a simple page where I created a Gauge and a button that randomizes the values of the different parts of the Gauge.
The
app works fine, it's just that when I run it on the VS2013 WP8 emulator
it looks perfectly smooth, and instead it lags a lot on my Lumia 920.
I was wondering: is there something wrong with my code, or is it normal?
This is the file .xaml
And this is the .cs
I also attached a screen of the WP8 emulator.
Thank you :)
Sergio
I have a simple page where I created a Gauge and a button that randomizes the values of the different parts of the Gauge.
The
app works fine, it's just that when I run it on the VS2013 WP8 emulator
it looks perfectly smooth, and instead it lags a lot on my Lumia 920.
I was wondering: is there something wrong with my code, or is it normal?
This is the file .xaml
<Grid x:Name="LayoutRoot" Background="{StaticResource imgKey}"> <!--TitlePanel contiene il nome dell'applicazione e il titolo della pagina--> <StackPanel Grid.Row="0" Margin="12,17,0,28"> <TextBlock Text="Funzioni varie" Style="{StaticResource PhoneTextNormalStyle}"/> <TextBlock Text="Contatore" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> </StackPanel> <!--Controlli ed elementi della pagina tranne il grafico e il totale--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Button x:Name="Randomizza_" Content="Randomizza!" HorizontalAlignment="Left" Margin="130,500,0,0" VerticalAlignment="Top" Click="Randomizza__Click"/> </Grid> <gauges:RadialGaugeRange TickStep="10" LabelStep="20" LabelRadiusScale="0.92" TickRadiusScale="0.8" MinAngle="0.8" MaxAngle="179.4"> <gauges:RadialGaugeRange.TickTemplate> <DataTemplate> <Rectangle Width="20" Height="5" Fill="Gray" /> </DataTemplate> </gauges:RadialGaugeRange.TickTemplate> </gauges:RadialGaugeRange> <gauges:RadialGaugeRange TickStep="0" LabelStep="0"> <gauges:RadialBarGaugeIndicator gauges:RadialGaugeRange.IndicatorRadiusScale="0.75" BorderThickness="10" IsAnimated="False" BarThickness="8" Value="100" Background="White" BarBrush="Gray" /> </gauges:RadialGaugeRange> <gauges:RadialGaugeRange TickRadiusScale="0.5" LabelStep="0" TickStep="0"> <!--Freccia--> <gauges:ArrowGaugeIndicator x:Name="Freccia" ArrowBrush="Crimson" ArrowThickness="5" ArrowTailRadius="2" gauges:RadialGaugeRange.IndicatorRadiusScale="0.85" Value="0" IsAnimated="True" AnimationDuration="0:0:0.7" /> </gauges:RadialGaugeRange> <gauges:RadialGaugeRange TickStep="0" LabelStep="0"> <gauges:RadialBarGaugeIndicator x:Name="Barra_bianca" gauges:RadialGaugeRange.IndicatorRadiusScale="0.6" BorderThickness="10" IsAnimated="True" BarThickness="50" Value="0" Background="White" BarBrush="White" /> </gauges:RadialGaugeRange> <gauges:RadialGaugeRange TickStep="0" LabelStep="0"> <gauges:RadialBarGaugeIndicator x:Name="Barra_verde" gauges:RadialGaugeRange.IndicatorRadiusScale="0.168" BorderThickness="10" IsAnimated="True" BarThickness="55" Value="0" Background="White" BarBrush="#FF0A7C29" /> </gauges:RadialGaugeRange> <gauges:RadialGaugeRange TickStep="0" LabelStep="0"> <gauges:RadialBarGaugeIndicator x:Name="Barra_blu" gauges:RadialGaugeRange.IndicatorRadiusScale="0.38" BorderThickness="10" IsAnimated="True" BarThickness="30" Value="0" Background="White" BarBrush="#FF2C4CA0" /> </gauges:RadialGaugeRange> <TextBlock x:Name="Percentuale" HorizontalAlignment="Left" Margin="115,405,0,0" TextWrapping="Wrap" Text="Totale >>> 0 %" VerticalAlignment="Top" Width="345" FontSize="30" FontWeight="Bold"/> </Grid></phone:PhoneApplicationPage>And this is the .cs
namespace App_panorama_esercitazione{ public partial class TelerikGauge : PhoneApplicationPage { public TelerikGauge() { InitializeComponent(); ValoriCasuali(); } private void Randomizza__Click(object sender, RoutedEventArgs e) { ValoriCasuali(); } private async void ValoriCasuali() { Random generaSequenza = new Random(); int bianco, verde, blu; bianco = generaSequenza.Next(0, 100); verde = generaSequenza.Next(0, 100); blu = generaSequenza.Next(0, 100); Freccia.Value = (float)((bianco + verde + blu) * 100) / 300; Barra_bianca.Value = bianco; await System.Threading.Tasks.Task.Delay(200); Barra_blu.Value = blu; await System.Threading.Tasks.Task.Delay(200); Barra_verde.Value = verde; await System.Threading.Tasks.Task.Delay(200); Percentuale.Text = "Totale >>> " + Freccia.Value.ToString("####0.00") + " %"; } }}I also attached a screen of the WP8 emulator.
Thank you :)
Sergio