简体   繁体   English

如何删除wpf的telerik的RadDesktopAlert控件中的默认关闭按钮,这可能吗?

[英]How to remove default close button in RadDesktopAlert control of telerik for wpf, is this possible?

How to remove the default close button in RadDesktopAlert control of telerik for WPF, is this possible? 如何删除WPF的telerik的RadDesktopAlert控件中的默认关闭按钮,这可能吗?

My code is below: 我的代码如下:

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);            
}

One simple approach that I take to any of the RadControls is to redefine the style in my application overwriting the style created by Telerik. 我对任何RadControl采取的一种简单方法是在应用程序中重新定义样式,以覆盖Telerik创建的样式。 In this case I would define a style in the App.xaml in the section <Application.Resources> section. 在这种情况下,我将在<Application.Resources>部分的App.xaml中定义样式。

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

This will overwrite the style for each case the control is used. 这将覆盖使用控件的每种情况的样式。 You can limit the scope of the change by redefining the style in the Window/Page/UserControl closest to where it is used. 您可以通过在最接近使用窗口/页面/用户控件的位置重新定义样式来限制更改的范围。

Now the style provided from Telerik is likely to be fairly complicated. 现在,Telerik提供的样式可能相当复杂。 So as a starting point copy the style from the Telerik Theme you are interested in. You can typically find these in the following location C:\\Program Files (x86)\\Telerik\\UI for WPF ....\\Themes.Implicit\\... . 因此,从您感兴趣的Telerik主题中复制样式作为起点。通常可以在以下位置找到这些样式C:\\Program Files (x86)\\Telerik\\UI for WPF ....\\Themes.Implicit\\...

From a quick look it is held in the Telerik.Windows.Controls.Navigation.xaml 快速浏览一下,它将保存在Telerik.Windows.Controls.Navigation.xaml

Copy the style itself to your App.xaml and the linked styles or control templates from this file and just remove the close button. 将样式本身复制到您的App.xaml并从该文件复制链接的样式或控件模板,然后删除关闭按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM