Avalonia 使用Behavior控制加载数据

  <UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:vm="using:xxxx.Pc.AddressBookModule.ViewModels"
             xmlns:model="using:xxxx.Pc.AddressBookModule.ViewModels"
             xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
             xmlns:atom="https://atomui.net/"
             xmlns:cvt="using:xxxx.Pc.Controls.Converters"
             mc:Ignorable="d" d:DesignWidth="670" d:DesignHeight="450"
             x:DataType="vm:FriendLabelViewModel"
             x:Class="xxxx.Pc.AddressBookModule.Views.FriendLabelView">
    <Design.DataContext>
        <vm:FriendLabelDesignViewModel></vm:FriendLabelDesignViewModel>
    </Design.DataContext>
    <Interaction.Behaviors>
        <EventTriggerBehavior EventName="Loaded">
            <InvokeCommandAction Command="{Binding ViewLoadedCommand}"></InvokeCommandAction>
        </EventTriggerBehavior>
    </Interaction.Behaviors>
  </UserControl>
posted @ 2026-02-11 13:33  Timskt  阅读(9)  评论(0)    收藏  举报