WPF弱订阅IsEnabledChanged事件

时间:2019-08-02 13:50:27

标签: wpf dependency-properties weak-events weakeventmanager

是否有可能订阅using PrivateNameSpace.Common.EntityFramework; using PrivateNameSpace.Data.DbContext; using PrivateNameSpace.Data.Repos.Interfaces; using Microsoft.EntityFrameworkCore; using System.Data.SqlClient; using System.Linq; public class OrganizationRepository: Repository<Entities.Organization, int, OrganizationContext>, IOrganizationRepository { private const string storedProcedure = "dbo.sproc_organizations_by_userid"; public OrganizationRepository(OrganizationContext context) : base(context) { DbSet = Context.Organizations; } public IQueryable<Entities.Organization> GetOrganizationsByUserId(int userId) { var sql = $"{Sproc} @UserId"; var result = Context.Organizations.FromSql(sql, new SqlParameter("@UserId", userId)); return result; } } 事件?

UIElement.IsEnabledChanged

都没有
WeakEventManager<TEventSource, TEventArgs>

似乎起作用,因为WeakEventManager<UIElement, DependencyPropertyChangedEventArgs> .AddHandler(uie, nameof(UIElement.IsEnabledChanged), Element_isEnabledChanged); 不扩展DependencyPropertyChangedEventArgs
也没有TEventArgs

PropertyChangedEventManager

之所以起作用,是因为PropertyChangedEventManager .AddHandler(uie, Element_isEnabledChanged, nameof(UIElement.IsEnabled)); 没有实现UIElement!人们应该如何安全地订阅该活动?

0 个答案:

没有答案