Unplanned
Last Updated: 20 Dec 2019 11:23 by ADMIN
Marco
Created on: 17 Dec 2019 19:10
Category: DesktopAlert
Type: Feature Request
3
Multiple Buttons / Commands like WinForms

Want to add multiple Buttons/Commands without changing whole style.

Like: https://docs.telerik.com/devtools/winforms/controls/desktopalert/button-items

3 comments
ADMIN
Dilyan Traykov
Posted on: 20 Dec 2019 11:23

Hello Marco,

Thank you for sharing your solution with our community. I do hope you find it suitable while we implement this feature.

Regards,
Dilyan Traykov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Marco
Posted on: 19 Dec 2019 13:12

Thank you for your efforts.

FYI

I also found this example and build my workaround for this with the help of Stack overflow ( How do I build a DataTemplate in c# code? ). I need it for a behavior with code behind:

var style = new Style(typeof(RadDesktopAlert));

DataTemplate alertDataTemplate = new DataTemplate {DataType = typeof(RadDesktopAlert)};

//set up the stack panel
FrameworkElementFactory spFactory = new FrameworkElementFactory(typeof(StackPanel));
spFactory.SetValue(StackPanel.OrientationProperty, Orientation.Vertical);

//set up the card holder textblock
FrameworkElementFactory cardHolder = new FrameworkElementFactory(typeof(TextBlock));
cardHolder.SetBinding(TextBlock.TextProperty, new Binding("")); // empty Binding = Content
spFactory.AppendChild(cardHolder);

//set up the stack panel
FrameworkElementFactory buttonSpFactory = new FrameworkElementFactory(typeof(StackPanel));
buttonSpFactory.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
spFactory.AppendChild(buttonSpFactory);

//set up the notes textblock
FrameworkElementFactory buttonIsin = new FrameworkElementFactory(typeof(RadButton));
buttonIsin.SetValue(RadButton.CommandProperty, _adoptAllCommand);
buttonIsin.SetValue(RadButton.ContentProperty, "All");
buttonSpFactory.AppendChild(buttonIsin);

FrameworkElementFactory buttonAll = new FrameworkElementFactory(typeof(RadButton));
buttonAll.SetValue(RadButton.CommandProperty, _adoptIsinCommand);
buttonAll.SetValue(RadButton.ContentProperty, "Same ISIN");
buttonSpFactory.AppendChild(buttonAll);

//set the visual tree of the data template
alertDataTemplate.VisualTree = spFactory;

//set the item template to be our shiny new data template
style.Setters.Add(new Setter(RadDesktopAlert.ContentTemplateProperty, alertDataTemplate));

var alert = new DesktopAlertParameters
{
    Header = "Take over values",
    Content = "Change " + (e.Cell.Column.Header is string ? e.Cell.Column.Header : e.Cell.Column.UniqueName) + " to " + newVal + "?",
    DesktopAlertStyle = style,
};
 
ADMIN
Dilyan Traykov
Posted on: 19 Dec 2019 12:54

Hi Marco,

Thank you for your feedback.

If this feature request accumulates enough votes, we will consider introducing additional properties to add custom content to the RadDesktopAlerts.

For the time being, you can only achieve the desired result by modifying the control template of the RadDesktopAlert control.

For your convenience, I've prepared a small sample project to demonstrate how to achieve a layout similar to the one in the article you referenced.

Could you please have a look and let me know whether such an approach would be applicable for you for the time being?

Regards,
Dilyan Traykov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Attached Files: