CityPicker 0.0.9999

There is a newer version of this package available.
See the version list below for details.
dotnet add package CityPicker --version 0.0.9999
                    
NuGet\Install-Package CityPicker -Version 0.0.9999
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CityPicker" Version="0.0.9999" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CityPicker" Version="0.0.9999" />
                    
Directory.Packages.props
<PackageReference Include="CityPicker" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CityPicker --version 0.0.9999
                    
#r "nuget: CityPicker, 0.0.9999"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CityPicker@0.0.9999
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CityPicker&version=0.0.9999
                    
Install as a Cake Addin
#tool nuget:?package=CityPicker&version=0.0.9999
                    
Install as a Cake Tool

Address in the mainland of China (applicable to areas other than Hong Kong, Macao, and Taiwan) 除港澳台外的国内地址选择器

适用于WPF Windows系统 ,NetCore以及Avalonia 跨平台系统,根据自述文件旁边的【包详细信息】列出的框架版本号选择对应的版本

当前版本为MAUI net10-android net10-ios net10-maccatalyst net10-windows net10-tizen net10-netstandard2.0

Getting started 用法:

1、 项目通过NuGet安装 Newtonsoft.Json

2、 在.axml文件中添加引用

<Window ...

    xmlns:d=...   

    xmlns:mc=.....   

    x:Class=.....   

    xmlns:local="clr-namespace:CityPicker;assembly=CityPicker"   

    ....>   

3、在正文中使用:
...

<local:Address x:Name="textBlock" HinText="国内省市区镇" TitleBackground="Beige" PopTextColor="Red" BtnTxt1="省会" Width="500" HinIDText="" SplitChar="/" TxtBackground="Green" LevelCount="3" QHoverBackground="Aquamarine" QBackground="Blue" BtnWidth="100" Height="20" > ...

地址选择前显示信息[当前参数只适用于MAUI]:

HinText:选择省市前的提示说明文字(推荐MVVM绑定获取)

HinIDText: 选择数据集返回ID信息(推荐MVVM绑定获取)

TxtBackground:点击出现弹窗前前信息显示的文本宽度

QHoverBackground:下拉列表中鼠标经过时的背景色

QBackground:弹出框下拉列表背景色

PopTextColor:弹出框下拉列表中字体颜色

TitleBackground:省市镇区等背景色

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格式文件,并命名成AddressData.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 Compatible and additional computed target framework versions.
.NET net10.0-android36.0 is compatible.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst26.0 is compatible.  net10.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 121 5/14/2026
11.3.1144 98 5/14/2026
11.2.6444 100 5/14/2026
10.0.5555 95 5/22/2026
9.0.5555 96 5/13/2026
8.0.5555 103 5/13/2026
7.0.5555 93 5/13/2026
6.0.5555 97 5/13/2026
5.0.5555 96 5/13/2026
4.8.5555 103 5/13/2026
3.1.5555 97 5/13/2026
3.0.5555 95 5/13/2026
0.9999.0 103 5/16/2026
0.0.9999 101 5/22/2026
Loading failed