Xaramin.Android.CityPicker
1.0.1
dotnet add package Xaramin.Android.CityPicker --version 1.0.1
NuGet\Install-Package Xaramin.Android.CityPicker -Version 1.0.1
<PackageReference Include="Xaramin.Android.CityPicker" Version="1.0.1" />
<PackageVersion Include="Xaramin.Android.CityPicker" Version="1.0.1" />
<PackageReference Include="Xaramin.Android.CityPicker" />
paket add Xaramin.Android.CityPicker --version 1.0.1
#r "nuget: Xaramin.Android.CityPicker, 1.0.1"
#:package Xaramin.Android.CityPicker@1.0.1
#addin nuget:?package=Xaramin.Android.CityPicker&version=1.0.1
#tool nuget:?package=Xaramin.Android.CityPicker&version=1.0.1
Address in the mainland of China (applicable to areas other than Hong Kong, Macao, and Taiwan) 除港澳台外的国内地址选择器
适用于WPF Windows系统 ,NetCore以及Avalonia 跨平台系统以及MAUI手机移动端系统,根据自述文件旁边的【包详细信息】列出的框架版本号选择对应的版本
MAUI版本请选择0.0.8889版本进行安装,Xamarin.Forms版本请选择0.0.9999,其他版本请选择CityPicker包按对应的版本选择
Getting started 用法:
1、 项目通过NuGet安装 Newtonsoft.Json
2、 在.axml文件中添加引用
<Window ...
xmlns:d=...
xmlns:mc=.....
x:Class=.....
xmlns:pc1="clr-namespace:CityPicker;assembly=CityPicker"
....>
3、在正文中使用:
...
<pc1:Address Name="textBlock" TitleActiveBackground="Gold" TitleActiveForeground="White" HinText="国内省市区镇" BtnTxt1="省会" Width="300" HinIDText="" SplitChar="/" Background="Red" Foreground="#FFFFFF" LevelCount="3" QHoverBackground="Aquamarine" QBackground="Yellow" BtnWidth="100" Height="50" ></pc1:Address>
...
地址选择前显示信息: (** 只代码当前版本中有)
HinText:选择省市前的提示说明文字(推荐MVVM绑定获取)
HinIDText: 选择数据集返回ID信息(推荐MVVM绑定获取)
Width:整个选择结果的宽度,过小会自动换行显示
QHoverBackground:下拉列表中鼠标经过时的背景色
TitleBackground:弹出框标题栏背景色
TitleForeground:弹出框标题栏文字颜色
PopTextColor:弹出框中选择项字颜色
TitleActiveBackground:当前标题激活时背景
TitleActiveForeground:当前标题激活时文字颜色
JsonFile:自定义json参数,见小技巧
QBackground:弹出框下拉列表背景色
SplitChar:数据连接,推荐使用 / - |
弹出菜单效果设置
LevelCount:级数,当前有省/城市/区/街道/村镇共五级,
如只要省会,设置1,如需要全部区域,设置5
BtnTxt1:省会
BtnTxt2:市
BtnTxt3:区
BtnTxt4:街道
BtnTxt5:村委
小技巧:
public class AdministrativeDivision
{
public string Code { get; set; } // 代码ID,注意是字符器类型的数字ID
public string Name { get; set; } // 名称
public List<AdministrativeDivision> Children { get; set; }
}
#一) 在执行文件目录下创建上述类的JSON格式文件,当用参数JsonFile="ProductCate.json"放在程序运行目录下,可以改成产品目录选择器或职业类型选择器,最多只能五层
如:
[{"Code":"1120","Name":"蔬菜水果","Children":[{"Code":"1121","Name":"苹果"}]},{"Code":"1320","Name":"服装","Children":[{"Code":"1345","Name":"男士服装"}]}]
#二)也可以传入上述的List<AdministrativeDivision>数据集自行定义数据集,不需要使用Json格式的文件即可作为参数传入进行绑定,如:
<local:Address AddressData="{Binding MyAddressList}" />
其中:MyAddressList为上述List<AdministrativeDivision>数据集
严禁用于非法用途
如有新的需求,请联系作者,如果喜欢,可捐赠以示感谢:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.4)
- Xamarin.Forms (>= 5.0.0.2662)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 100 | 5/16/2026 |