如何删除wpf遥控器RadDesktopAlert控制中的默认关闭按钮,这是可能的吗



如何删除WPF遥控器RadDesktopAlert控制中的默认关闭按钮,这可能吗?

我的代码如下:

public RadDesktopAlertManager ExecuteBatchDesktopAlert=new RadDesktopAlertManager(AlertScreenPosition.BottomRight,new Point(5,5),5);
public void ShowNotification(string header, string content)
{
    var radAlert = new RadDesktopAlert
    {                
        Header = header,
        Content = content,
        Height = 90,
        Width = 300,
        Opacity = 1,
        Background = Brushes.Gray,
    };
    ExecuteBatchDesktopAlert.ShowAlert(radAlert);            
}

我对任何RadControls采取的一种简单方法是在应用程序中重新定义样式,覆盖Telerik创建的样式。在这种情况下,我将在<Application.Resources>部分的App.xaml中定义一个样式。

<Style TargetType="telerik:RadDesktopAlert">
....
</Style>

这将覆盖每个使用控件的情况下的样式。您可以通过在最接近使用样式的窗口/页面/用户控件中重新定义样式来限制更改的范围。

现在Telerik提供的风格可能相当复杂。因此,作为一个起点,复制你感兴趣的Telerik主题中的风格。你通常可以在以下位置C:Program Files (x86)TelerikUI for WPF ....Themes.Implicit...找到这些。

快速查看,它保存在Telerik.Windows.Controls.Navigation.xaml

将样式本身复制到此文件中的App.xaml和链接样式或控制模板,然后只需删除关闭按钮。

最新更新