WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 4e8d91f

Browse files
committed
ForecastRangeBar: hide icon if not available
1 parent 8722637 commit 4e8d91f

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

Maui/SimpleWeather.Maui/Controls/ForecastRangeBar.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@
7777
Rotation="{Binding XIconRotation, Mode=OneWay}"
7878
AnchorX="0.5"
7979
AnchorY="0.5"
80-
WeatherIcon="{Binding XWeatherIcon, Mode=OneWay}" />
80+
WeatherIcon="{Binding XWeatherIcon, Mode=OneWay}"
81+
IsVisible="{Binding XWeatherIcon, Converter={StaticResource objectBooleanConverter}, Mode=OneWay}"/>
8182
<Label
8283
x:Name="BarDate"
8384
HorizontalOptions="Center"

SimpleWeather.Windows/Controls/ForecastRangeBar.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
IconHeight="50"
8282
IconWidth="50"
8383
RenderTransformOrigin="0.5,0.5"
84-
WeatherIcon="{x:Bind Data.XWeatherIcon, Mode=OneWay}">
84+
WeatherIcon="{x:Bind Data.XWeatherIcon, Mode=OneWay}"
85+
Visibility="{x:Bind Data.XWeatherIcon, Converter={StaticResource stringVisibilityConverter}, Mode=OneWay}">
8586
<local:IconControl.RenderTransform>
8687
<RotateTransform Angle="{x:Bind Data.XIconRotation, Mode=OneWay}" />
8788
</local:IconControl.RenderTransform>

SimpleWeather.Windows/Controls/ForecastRangeBar.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ public ForecastType? ForecastType
3535
{
3636
_forecastType = value;
3737
BarPoP.Visibility = _forecastType == Controls.ForecastType.Temperature ? Visibility.Visible : Visibility.Collapsed;
38+
BarDate.FontSize = BarHi.FontSize = BarLo.FontSize = _forecastType switch
39+
{
40+
Controls.ForecastType.Temperature => 16,
41+
_ => 14
42+
};
43+
BarIcon.IconHeight = BarIcon.IconWidth = _forecastType switch
44+
{
45+
Controls.ForecastType.Temperature => 50,
46+
_ => 30
47+
};
3848
}
3949
}
4050

SimpleWeather.Windows/Main/WeatherAQIPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
GraphHeight="250" />
105105
</toolkitControls:HeaderedContentControl>
106106
</DataTemplate>
107-
<DataTemplate x:Key="AQIRangeBarGraphTemplate" x:DataType="graphs:RangeBarGraphData">
107+
<DataTemplate x:Key="AQIRangeBarGraphTemplate" x:DataType="graphs:ForecastRangeBarGraphData">
108108
<toolkitControls:HeaderedContentControl
109109
Margin="0,16"
110110
HorizontalContentAlignment="Stretch"

SimpleWeather.Windows/Main/WeatherAQIPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected override DataTemplate SelectTemplateCore(object item, DependencyObject
141141
{
142142
return elementParent.Resources["AQIBarGraphTemplate"] as DataTemplate;
143143
}
144-
else if (item is RangeBarGraphData)
144+
else if (item is ForecastRangeBarGraphData)
145145
{
146146
return elementParent.Resources["AQIRangeBarGraphTemplate"] as DataTemplate;
147147
}

0 commit comments

Comments
 (0)