With NT7 I accomplished this by adding multiple buttons to a ToolStrip and add that toolstrip to the chartcontrol controls, docking it at the bottom... Now with NT8 and WPF, this will be handled with Dock and Stack Panels and I believe usercontrols vs controls.. Idealistically I'd ultimately like to utilize my existing WinForms code for the toolstip and add that thru the use of Windows.Forms.Integration and WindowsFormHost (I've successfully accomplished this in a WPF project in VS, a discussion here for later), but for now I'm playing with the idea of just adding buttons to a dockpanel and placing that dockpanel at the bottom of the chartpanel independently in whatever window the indicator is added..
So far I've tried going two routes, each with its own success, yet each ultimately failing in a different way.. The first approach is creating a couple buttons, adding each button to its own stackpanel (doing this mainly because it was the only way so far I found that I could successfully change the size of the buttons being displayed), then adding each stackpanel to the dockpanel, then adding the dockpanel to a usercontrol, then adding that usercontrol as a child of the chartcontrol.. This seems to work, in that it adds the buttons and the routed event of each button work(open an output window and the button name will be printed on each click), But the dockpanel seems to be being added as a completely separate object/control, offsetting the bars and chartpanel on both the left and right side the width of the dockpanel itself..
The second approach I took was pretty much the same in every aspect, except instead of adding the usercontrol as a child to the chartcontrol, adding the usercontrol as content to the chartpanel.. Now aesthetically this works perfectly.. But now the problem comes that none of the buttons are clickable and am unable to accomplish any routable events..
I've provided a code sample below. It could definitely be done more efficiently, and contains no comments, but I've tried to keep the flow in a way I believe it should be easily understood. The Dispatcher is used for threading issues. The indicator contains only one bool property.. setting it to true will add the usercontrol as a child to the chartcontrol, and setting it to false will add the usercontrol to the content of the chartpanel.. By changing this in the properties from true to false and so forth, you should very easily be able to see and understand what I've tried to explain above..
Now I could be totally off base here with my approach, but would be very interested in hearing if anyone has been successful with this endeavor, has possibly taken a different approach, or has any suggestions, hints, ideas on what I'm doing wrong (not doing) and/or the proper way of accomplishing this..
Comment