CityPicker 12.0.4444
dotnet add package CityPicker --version 12.0.4444
NuGet\Install-Package CityPicker -Version 12.0.4444
<PackageReference Include="CityPicker" Version="12.0.4444" />
<PackageVersion Include="CityPicker" Version="12.0.4444" />
<PackageReference Include="CityPicker" />
paket add CityPicker --version 12.0.4444
#r "nuget: CityPicker, 12.0.4444"
#:package CityPicker@12.0.4444
#addin nuget:?package=CityPicker&version=12.0.4444
#tool nuget:?package=CityPicker&version=12.0.4444
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版本稍候推出。
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 | net8.0 is compatible. 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. |
-
net8.0
- Avalonia (>= 12.0.0)
- Avalonia.Desktop (>= 12.0.0)
- Avalonia.Fonts.Inter (>= 12.0.0)
- Avalonia.Themes.Fluent (>= 12.0.0)
- ConfuserEx (>= 0.6.0)
- Newtonsoft.Json (>= 13.0.4)
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 |
|---|---|---|
| 12.0.4444 | 97 | 5/14/2026 |
| 11.3.1144 | 91 | 5/14/2026 |
| 11.2.6444 | 89 | 5/14/2026 |
| 10.0.5555 | 84 | 5/22/2026 |
| 9.0.5555 | 86 | 5/13/2026 |
| 8.0.5555 | 89 | 5/13/2026 |
| 7.0.5555 | 81 | 5/13/2026 |
| 6.0.5555 | 89 | 5/13/2026 |
| 5.0.5555 | 87 | 5/13/2026 |
| 4.8.5555 | 87 | 5/13/2026 |
| 3.1.5555 | 90 | 5/13/2026 |
| 3.0.5555 | 88 | 5/13/2026 |
| 0.9999.0 | 90 | 5/16/2026 |
| 0.0.9999 | 88 | 5/22/2026 |