title: C# Android Xamarin - if else statement
body: <p>I'm currently trying to fix this issue in the UI, where the pin drop alert is only showing half/ hidden on the screen:
  <a href="https://i.stack.imgur.com/0PG6I.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>I added the center alignment/position in the XAML. My problem is how can I change this if condition and insert or modify the condition to add Center Alignment/Position.</p>
  <pre><code>&gt; SmartAlertPins = new List&lt;AnnotationData&gt;();
                  int i = 0;
                  if (History?.AlertPins?.Count &gt; 0)
                  {
                      foreach (var alert in History.AlertPins)
                      {
                          DateTime time = alert.DecisionLog == null ? (DateTime)uTCToDeviceTimeZoneConverter.Convert(alert.Time, null, null, CultureInfo.InvariantCulture) : (DateTime)uTCToDeviceTimeZoneConverter.Convert(alert.DecisionLog.UtcTimeStamp, null, null, CultureInfo.InvariantCulture);
                          History.AlertPins[i].TypeIcon = (string)alertTypeToImage.Convert(alert, null, null, CultureInfo.InvariantCulture);
                          History.AlertPins[i].Position = (time - History.History.Start).Hours &lt;= 6 ? &quot;Left&quot; : &quot;Right&quot;;
                          History.AlertPins[i].Alignment = alert.Value &gt;= 4 ? &quot;Bottom&quot; : &quot;Top&quot;;
  
  
                          if (alert.Reason == null || alert.Reason == &quot;&quot;)
                              if (alert.Reason == null || alert.Reason == &quot;&quot;)
                                  History.AlertPins[i].Reason = _displayTextConverter.Convert(History.AlertPins[i].AlertReason, null, &quot;AlertCondition&quot;, CultureInfo.InvariantCulture).ToString();
                          if (alert.Action == null || alert.Action == &quot;&quot;)
                              History.AlertPins[i].Action = _displayTextConverter.Convert(History.AlertPins[i].AlertAction, null, &quot;AlertAction&quot;, CultureInfo.InvariantCulture).ToString();
  </code></pre>