728x90

DevExpress.Maui.Editors Nuget Package 설치
( 참고 : 
2022.09.24 - [C#/Xamarin Maui] - [.NET MAUI] DevExpress - 설치 및 설정 )

MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="Maui.DevExpressTest.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:dxe="clr-namespace:DevExpress.Maui.Editors;assembly=DevExpress.Maui.Editors">

    <ScrollView>
        <VerticalStackLayout
            Padding="30,0"
            Spacing="25"
            VerticalOptions="Center">

            <dxe:ComboBoxEdit ItemsSource="{Binding Items}" SelectedIndex="1" />
        </VerticalStackLayout>
    </ScrollView>

</ContentPage>

MainViewModel.cs

using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Input;

using Maui.DevExpressTest.Models;

namespace Maui.DevExpressTest.ViewModels
{
    public class MainViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        private ObservableCollection<string> items;

        public ObservableCollection<string> Items
        {
            get
            {
                return this.items;
            }
            set
            {
                this.items = value;
                OnPropertyChanged();
            }
        }

        public MainViewModel()
        {
            Items = new ObservableCollection<string>() { "Milk", "Tea", "Coffee" };
        }
    }
}

실행결과

[Source]
https://github.com/kei-soft/Maui.DevExpressTest

728x90
Posted by kjun.kr
,