Xamarin.Android、Syncfusion.SfPicker 缺少 UpdatePopup 函数
Xamarin.Android, Syncfusion.SfPicker has missing UpdatePopup function
我将 Syncfusion.SfPicker 用于 Xamarin.Android (https://help.syncfusion.com/xamarin-android/sfpicker/gettingstarted),并且我正在使用包含 SfPicker 的最新版本的 Syncfusion Nuget 库。
我的问题是收到以下错误:
Object reference not set to an instance of an object, at
Com.Syncfusion.SfPicker.SfPicker.UpdatePopup() [0x000d5] in
:0 at
Com.Syncfusion.SfPicker.SfPicker.set_IsOpen(System.Boolean value)
[0x00018] in <4cccb4f208d9407ca543d91156e77529>:0 at
MyTest_App.MainActivity.
当我在 MainActivity 中执行以下代码时:
protected override void OnCreate(Bundle savedInstanceState)
{
SfPicker picker = new SfPicker(this);
base.OnCreate(savedInstanceState);
picker.IsOpen = true;
SetContentView(picker);
}
文档 wrong/missing 是东西,还是我只是做错了?我遵循了上面链接的 URL 最后一个示例中的代码。
希望有人能阐明问题所在。
Is the documentation wrong/missing stuff, or am I simply doing it wrong? I followed the code from the last example of the URL I linked above.
你可以参考Syncfusion Official Sample link,为了避免这个异常,你必须给你的SfPicker
一个ItemsSource
。
例如创建一个ColorInfo
class :
public class ColorInfo
{
private ObservableCollection<string> _color;
public ObservableCollection<string> Colors
{
get { return _color; }
set { _color = value; }
}
public ColorInfo()
{
Colors = new ObservableCollection<string>();
Colors.Add("Red");
Colors.Add("White");
Colors.Add("Orange");
Colors.Add("Blue");
Colors.Add("Purple");
Colors.Add("Pink");
Colors.Add("SkyBlue");
Colors.Add("Yellow");
}
}
为您的 SfPicker
设置 ItemSource
:
SfPicker picker;
protected override void OnCreate(Bundle savedInstanceState)
{
picker = new SfPicker(this);
base.OnCreate(savedInstanceState);
ColorInfo info = new ColorInfo();
picker.ItemsSource = info.Colors;
picker.IsOpen = true;
SetContentView(picker);
}
我将 Syncfusion.SfPicker 用于 Xamarin.Android (https://help.syncfusion.com/xamarin-android/sfpicker/gettingstarted),并且我正在使用包含 SfPicker 的最新版本的 Syncfusion Nuget 库。
我的问题是收到以下错误:
Object reference not set to an instance of an object, at Com.Syncfusion.SfPicker.SfPicker.UpdatePopup() [0x000d5] in :0 at Com.Syncfusion.SfPicker.SfPicker.set_IsOpen(System.Boolean value) [0x00018] in <4cccb4f208d9407ca543d91156e77529>:0 at MyTest_App.MainActivity.
当我在 MainActivity 中执行以下代码时:
protected override void OnCreate(Bundle savedInstanceState)
{
SfPicker picker = new SfPicker(this);
base.OnCreate(savedInstanceState);
picker.IsOpen = true;
SetContentView(picker);
}
文档 wrong/missing 是东西,还是我只是做错了?我遵循了上面链接的 URL 最后一个示例中的代码。
希望有人能阐明问题所在。
Is the documentation wrong/missing stuff, or am I simply doing it wrong? I followed the code from the last example of the URL I linked above.
你可以参考Syncfusion Official Sample link,为了避免这个异常,你必须给你的SfPicker
一个ItemsSource
。
例如创建一个ColorInfo
class :
public class ColorInfo
{
private ObservableCollection<string> _color;
public ObservableCollection<string> Colors
{
get { return _color; }
set { _color = value; }
}
public ColorInfo()
{
Colors = new ObservableCollection<string>();
Colors.Add("Red");
Colors.Add("White");
Colors.Add("Orange");
Colors.Add("Blue");
Colors.Add("Purple");
Colors.Add("Pink");
Colors.Add("SkyBlue");
Colors.Add("Yellow");
}
}
为您的 SfPicker
设置 ItemSource
:
SfPicker picker;
protected override void OnCreate(Bundle savedInstanceState)
{
picker = new SfPicker(this);
base.OnCreate(savedInstanceState);
ColorInfo info = new ColorInfo();
picker.ItemsSource = info.Colors;
picker.IsOpen = true;
SetContentView(picker);
}