Xaml 如果稍微倾斜ios设备,SFCOMBOX将以xamarin形式向上滚动至顶部

Xaml 如果稍微倾斜ios设备,SFCOMBOX将以xamarin形式向上滚动至顶部,xaml,xamarin,xamarin.forms,xamarin.ios,syncfusion,Xaml,Xamarin,Xamarin.forms,Xamarin.ios,Syncfusion,如果稍微倾斜ios设备,SFCOMBOX会在xamarin.forms中向上滚动到顶部。这是在我们第一次进入页面时发生的 <combobox:SfComboBox DataSource="{Binding SamplePickerList, Mode=TwoWay}" HorizontalOptions="FillAndExpand" SelectedIndex="{Binding SamplePickerIndex, Mode=TwoW

如果稍微倾斜ios设备,SFCOMBOX会在xamarin.forms中向上滚动到顶部。这是在我们第一次进入页面时发生的

<combobox:SfComboBox DataSource="{Binding SamplePickerList, Mode=TwoWay}" HorizontalOptions="FillAndExpand"  SelectedIndex="{Binding SamplePickerIndex, Mode=TwoWay}"
                  VerticalOptions="FillAndExpand" SelectedItem="{Binding SamplePicker,Mode=TwoWay}" />

我们已经分析了您的查询,并根据您提供的信息检查了报告的问题,但我们无法重现该问题。我们试图复制的样本问题可以从下面下载

示例:

由于我们不知道该问题的确切情况,请您用随附的样本检查该问题,并告知是否复制了该问题?如果此示例中未再现此问题,请根据您的应用程序以及复制程序修改示例,或提供示例,以回复我们。这将有助于我们进一步调查,并尽早为您提供更好的解决方案

问候,,
Sakthivel P.

您可以通过使用SfComboBox渲染器解决此问题,并获取设备旋转和UITableView内容偏移位置。通过查看表视图的ContentOffset属性,可以轻松获取表视图的确切偏移量

样本:

代码段:

public class CustomComboBoxRenderer : SfComboBoxRenderer
{
        /// <summary>
        /// Find device rotation.
       /// </summary>
       UIDeviceOrientation orientation;
      public CustomComboBoxRenderer()
      {
             Foundation.NSNotificationCenter.DefaultCenter.AddObserver(new NSString("UIDeviceOrientationDidChangeNotification"), this.DeviceRotated);
      }
      private async void DeviceRotated(NSNotification obj)
      {
            if (this.Control.Text == string.Empty && this.Control.IsSuggestionOpen)
            {
                //// Get the table view position.
                var offset = this.Control.AutoCompleteTableView.TableView.ContentOffset;
                await System.Threading.Tasks.Task.Delay(1);
                //// Set the table view position while rotating.
                this.Control.AutoCompleteTableView.TableView.ContentOffset = offset;
            }
     }
} 
公共类CustomComboBoxRenderer:sfComboxRenderer
{
/// 
///查找设备旋转。
/// 
UIDeviceOrientation定向;
公共CustomComboxRenderer()
{
NeNoTrimeCaseCudio.Debug中心.AdvalDistor(新NSString(UIDEVICEORITION DICANEXENONECTION)),
}
专用异步无效设备旋转(NSOBJ)
{
if(this.Control.Text==string.Empty&&this.Control.IsSuggestionOpen)
{
////获取表格视图位置。
var offset=this.Control.AutoCompleteTableView.TableView.ContentOffset;
等待系统。线程。任务。任务。延迟(1);
////旋转时设置表格视图位置。
this.Control.AutoCompleteTableView.TableView.ContentOffset=偏移量;
}
}
} 

在此示例中,我们将使用UIDeviceOrientation在旋转前保存滚动位置,然后在设备倾斜后滚动到该行。

要重新创建,请从主页导航到某个页面,打开SFCOMBOX并滚动,然后轻微倾斜ios设备,然后该值将再次转到顶部。样本和视频附加这将给你一个错误时,控制为空。如果你检查如下将工作良好。如果(this.Control!=null&&this.Control.Text==string.Empty&&this.Control.IsSuggestionOpen)是。您可以根据以前的更新检查控件是否为null。