【问题标题】:Adding interaction behaviour dynamically动态添加交互行为
【发布时间】:2019-03-19 08:47:56
【问题描述】:

我的 MainWindow.xaml 文件中有以下代码:

<dxmvvm:Interaction.Behaviors>
    <dx:DXSplashScreenService SplashScreenType="local:LoadingSplashScreen" ShowSplashScreenOnLoading="True"/>
</dxmvvm:Interaction.Behaviors>

我需要能够从代码隐藏 (MainWindow.xaml.cs) 动态添加此代码。这可能吗?

我需要使用Interaction.GetBehaviors(yourElementName).Add(behavior)吗??

谢谢。

【问题讨论】:

标签: c# wpf xaml


【解决方案1】:

你可以加个赞,

var splashScreenService = new DevExpress.Xpf.Core.DXSplashScreenService 
                              { 
                                  SplashScreenType = typeof(LoadingSplashScreen), 
                                  ShowSplashScreenOnLoading = true 
                              };
DevExpress.Mvvm.UI.Interactivity.Interaction.GetBehaviors(yourElement).Add(splashScreenService);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-17
    • 1970-01-01
    • 1970-01-01
    • 2014-02-03
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多