Is that possible?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding button in Parameter window
Collapse
X
-
Hello WHICKED,
Thank you for your post.
This is possible, however it is not officially supported. We do have an unsupported example that you can reference:
Hey everyone, I'm currently trying to figure out a way on how to add a button on settings panel. I saw a post where they created a button but it's on the Chart Panel. Is there anyway I can create button on Settings Panel?
Note: This requires a reference to C:\Program Files\NinjaTrader 8\bin\System.Windows.Controls.WpfPropertyGrid.dll
This thread will remain open for any users who may want to assist or provide an unsupported solution.Last edited by NinjaTrader_Gaby; 04-26-2024, 01:12 PM.
-
here is the code that I came up with:
but when clicking on the button - nothing happensCode:public class ShowHelp : System.Windows.Controls.WpfPropertyGrid.PropertyEditor { public ShowHelp() { InlineTemplate = CreateTemplate(); } System.Windows.DataTemplate CreateTemplate() { const string xamlTemplate = @" <DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width='*'/> </Grid.ColumnDefinitions> <Button x:Name='helpButton' Grid.Column='0' Content='Click here for help' HorizontalAlignment='Center' VerticalAlignment='Center'/> </Grid> </DataTemplate>"; var context = new ParserContext(); context.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation"); context.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml"); System.Windows.DataTemplate template = (System.Windows.DataTemplate)System.Windows.Markup.XamlReader.Parse(xamlTemplate, context); // Add event handler dynamically after the template is loaded template.LoadContent(); // This loads the content defined by the DataTemplate if (template.LoadContent() is FrameworkElement rootElement && rootElement.FindName("helpButton") is Button helpButton) { helpButton.Click += OnHelpButtonClick; } return template; } private void OnHelpButtonClick(object sender, System.Windows.RoutedEventArgs e) { string url = "http://google.com"; try { System.Diagnostics.Process.Start(url); System.Diagnostics.Debug.WriteLine("Browser launched successfully."); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Failed to launch browser: " + ex.Message); } } }
Comment
-
Hello WHICKED,
While undocumented and not officially supported, i've slightly modified the example linked by Gaby.
LinkButtonCustomPropertyEditorsExample_NT8.zipChelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
607 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
353 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
561 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|
Comment