Tritium UI
TritiumAutoComplete
กรองรายการขณะที่ผู้ใช้พิมพ์ และผูกทั้งข้อความและรายการที่เลือก
คุณสมบัติหลัก
- กรองด้วย Contains หรือ StartsWith หลังจากจำนวนอักขระขั้นต่ำ
- ผูก ItemsSource กับสตริงหรืออ็อบเจกต์ แล้วนำรายการที่ตรงไปไว้ที่ SelectedItem
- คง Text สองทาง เพื่อขับช่องจากโค้ดได้
- แสดงสถานะกำลังทำงานขณะแทนที่รายการจากการค้นหา
- เลือกเปิดการตอบสนองแบบสั่นหรือเสียงเมื่อเลือกคำแนะนำ
- ซ่อนรายการคำแนะนำหลังเลือก
แพลตฟอร์ม
Android, iOS, Mac Catalyst และ Windows 10 เวอร์ชัน 19041 ขึ้นไป (.NET 10 MAUI)
API หลัก
- ItemsSource . The candidates to filter.
- Text . The current typed text, two-way.
- SelectedItem . The suggestion the user picked, two-way.
- FilterMode . Contains or StartsWith, after MinimumPrefixLength characters.
ตัวอย่างพื้นฐาน
ประกาศเนมสเปซนี้บนหน้า
xmlns:editors="clr-namespace:Tritium.Maui.Editors;assembly=Tritium.Maui.Editors"
<editors:TritiumAutoComplete ItemsSource="{Binding Cities}"
Text="{Binding CityQuery}"
SelectedItem="{Binding City}"
FilterMode="Contains"
MinimumPrefixLength="1" /> เพิ่มแหล่งแพ็กเกจจากไลเซนส์ แล้วอ้างอิงแพ็กเกจที่มีคอนโทรลนี้ แพ็กเกจเหล่านี้ไม่อยู่ในแกลเลอรี NuGet สาธารณะ