How can I add a toolbar in the toolbarpanel programmatically? - wpf

I want to add my ToolBar inside the ToolBarPanel in codebehind.
I saw one example of Button & Canvas panel.
Here is the code:
Canvas.SetLeft(newButton, containerPoint.X - objectPoint.X);
Canvas.SetTop(newButton, containerPoint.Y - objectPoint.Y);
How can I achive samething with ToolBar & ToolBarPanelinstead of using Canvas & Button?

The code you gave is not adding the button to canvas, it sets extension properties that specify coordinates the button will be located at, if it is placed on Canvas panel.
ToolBarPanel is a primitive panel used by ToolBar to arrange its items. Unless you want to customize behavior you should be just using ToolBar optionally placing it into ToolBarTray.
ToolBar is an ItemsControl (just like ListBox for example), so to add a button from code, add it to panel's Items collection:
toolbar.Items.Add(newButton);

Related

How to create a sliding side border WPF?

So, if you have seen the Windows 11 Store UI. I want to replicate the border or the sliding bar on the side where every time you click a button the border or sliding bar would go to that button and center it self in the middle.
Create a custom template for the button that has an ItemControl of a single border on the left along with the button content, and when it is selected and animate it.

Listview animation when my custom class added/removed/edited

I have a class called Note, that consists of Title,Content and a Date. And inside listview item template, I have some text blocks and buttons. For now, I can apply animations when edit/remove button clicked, because that buttons' tag are the Grid which I will animate. Since my class is not a framework element, it doesn't have transform and opacity property. How to do so?
Regards,
Talha
I had to use ItemContanerStyle

WPF ContextMenu / MenuItem - Hide vertical Separator

I have a context menu and inside are two menu items. To remove the check mark and icon for the menu items i've created a style which is working great. However i've noticed that in the background there is a vertical separator which i can't get rid of using style for context menu. Any help?

In ExtJS, how can I create a panel and have it hover above a TabPanel?

I have a viewport with a tab panel in it. I'm trying to create a standard panel dynamically and make it visible. I'm able to create the panel and isVisible() returns true after calling doLayout on the viewport but the panel is not visible on the screen. Is there any way to make it visible (i.e., to hover above the tab panel)?
If you create the panel as a child of the document body and position it absolutely it should show above your existing layout. You could also (more easily) use an Ext.Window to do this.

How to bring a menu to front of a navigation frame in silverlight?

I Have a Silverlight page with a header menu, a navigation frame, and a footer. In my header menu I want to put a drop down menu, but when I open the menu, it goes behind the frame.
Is there a way to put it forward? Canvas.ZIndex makes no difference at all.
For me to get this to work, the navigation frame had to be in a grid that was a child of the grid my menu was in.
Like so:
Grid "FullPageGrid"
Grid
Menu Stuff
Grid
Navigation Frame
Not sure why that works, but it does.
You can use this free opensource menu for this purpose:
www.sl4popupmenu.codeplex.com
It brings the content on top by placing in a Popup control.
If you can place the drop down menu later in the XAML, it will appear above.
So you want to have this hierarchy:
Grid
Grid
Your navigation frame
Grid
The menu

Resources