-
Notifications
You must be signed in to change notification settings - Fork 58
Data Source DotNet
Hendy Racher edited this page May 4, 2015
·
8 revisions
The DotNet Pickers can be configured with any custom class that implements IDotNetDataSource, for example:
using System.Collections.Generic;
using nuPickers.Shared.DotNetDataSource;
public class ExampleDotNetDataSource : IDotNetDataSource
{
IEnumerable<KeyValuePair<string, string>> IDotNetDataSource.GetEditorDataItems(int contextId)
{
// return a collection of key / labels for picker
}
}
In order to supply data to this method, string properties can be added to the class and marked with an attribute such that they are then rendered as additional options during the data-type configuration.
using System.Collections.Generic;
using nuPickers.Shared.DotNetDataSource;
public class ExampleDotNetDataSource : IDotNetDataSource
{
[DotNetDataSource(Title="Example Property", Description="example description")]
public string ExampleProperty { get; set; }
IEnumerable<KeyValuePair<string, string>> IDotNetDataSource.GetEditorDataItems(int contextId)
{
// return a collection of key / labels for picker
}
}
Example: nuPickers Flickr Pickers