Skip to content

Commit 0e4bb19

Browse files
committed
update ToolBarAdv-state.md
1 parent 7e764c4 commit 0e4bb19

File tree

1 file changed

+60
-44
lines changed

1 file changed

+60
-44
lines changed

wpf/ToolBar/ToolBarAdv-state.md

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -19,59 +19,75 @@ ToolBarAdv provides different states such as Docking, Floating or Hidden. It can
1919
<syncfusion:ToolBarTrayAdv >
2020
<syncfusion:ToolBarAdv ToolBarName="Standard" Band="0">
2121
<Button syncfusion:ToolBarAdv.Label="New Document"
22-
syncfusion:ToolBarAdv.Icon="Images/NewDocumentHS.png">
22+
syncfusion:ToolBarAdv.Icon="Images/New.png">
2323
<Image Source="Images/NewDocumentHS.png" Width="16" Height="16"/>
2424
</Button>
2525
<Button syncfusion:ToolBarAdv.Label="Open Document"
26-
syncfusion:ToolBarAdv.Icon="Images/openHS.png">
27-
<Image Source="Images/openHS.png" Width="16" Height="16"/>
26+
syncfusion:ToolBarAdv.Icon="Images/Open.png">
27+
<Image Source="Images/OpenDocument.png" Width="16" Height="16"/>
2828
</Button>
2929
<syncfusion:ToolBarAdv Band="1" ToolBarName="Extras"
3030
syncfusion:ToolBarManager.ToolBarState="Floating"
3131
FloatingBarLocation="500,300">
32-
<Button syncfusion:ToolBarAdv.Label="Insert Picture"
33-
syncfusion:ToolBarAdv.Icon="Images/InsertPictureHS.png">
34-
<Image Source="Images/InsertPictureHS.png" Width="16" Height="16"/>
35-
</Button>
36-
<Button syncfusion:ToolBarAdv.Label="Insert Hyperlink"
37-
syncfusion:ToolBarAdv.Icon="Images/InsertHyperlinkHS.png">
38-
<Image Source="Images/InsertHyperlinkHS.png" Width="16" Height="16"/>
32+
<Button syncfusion:ToolBarAdv.Label="Save Document"
33+
syncfusion:ToolBarAdv.Icon="Images/Save.png">
34+
<Image Source="Images/SaveDocument.png" Width="16" Height="16"/>
3935
</Button>
4036
<Button syncfusion:ToolBarAdv.Label="Insert Table"
41-
syncfusion:ToolBarAdv.Icon="Images/TableHS.png">
42-
<Image Source="Images/TableHS.png" Width="16" Height="16"/>
37+
syncfusion:ToolBarAdv.Icon="Images/Insert.png">
38+
<Image Source="Images/InsertTable.png" Width="16" Height="16"/>
4339
</Button>
4440
</syncfusion:ToolBarAdv>
4541
</syncfusion:ToolBarAdv>
4642
</syncfusion:ToolBarTrayAdv>
4743
</syncfusion:ToolBarManager.TopToolBarTray>
48-
<Grid>
49-
<Grid.RowDefinitions>
50-
<RowDefinition Height="*"/>
51-
<RowDefinition Height="Auto"/>
52-
</Grid.RowDefinitions>
53-
<ScrollViewer >
54-
<Grid Margin="20">
55-
<Border CornerRadius="2" Background="Black"
56-
Opacity="0.3" Width="600" Height="700">
57-
<Border.Effect>
58-
<BlurEffect Radius="15"/>
59-
</Border.Effect>
60-
</Border>
61-
<RichTextBox Width="600" Height="700" Padding="20"></RichTextBox>
62-
</Grid>
63-
</ScrollViewer>
64-
</Grid>
6544
</syncfusion:ToolBarManager>
6645

6746
{% endhighlight %}
6847

6948
{% highlight C# %}
7049

71-
ToolBarAdv toolBar = new ToolBarAdv();
72-
toolBar.FloatingBarLocation = new Point(500, 300);
73-
ToolBarManager.SetToolBarState(toolBar, ToolBarState.Floating);
74-
Grid1.Children.Add(toolBar);
50+
ToolBarManager toolBarManager = new ToolBarManager();
51+
//Initialize ToolBarTrayAdv
52+
ToolBarTrayAdv toolBarTray = new ToolBarTrayAdv();
53+
// Initialize toolbar1 and subscribe to ToolBarStateChanged event
54+
ToolBarAdv toolbar1 = new ToolBarAdv();
55+
// Add a button to the toolbar1
56+
toolbar1.Items.Add(new Button
57+
{
58+
Content = new Image
59+
{
60+
Source = new BitmapImage(new Uri("Images/Open.png")),
61+
Stretch = Stretch.Uniform
62+
},
63+
Height = 40,
64+
Width = 40,
65+
ToolTip = "Open Folder",
66+
Margin = new Thickness(5, 0, 5, 0)
67+
});
68+
// Add toolbar1 to the ToolBarTrayAdv
69+
toolBarTray.ToolBars.Add(toolbar1);
70+
// Set Floating location for the floating toolbar
71+
toolbar1.FloatingBarLocation = new Point(500, 300);
72+
// Set the floating toolbar state to floating
73+
ToolBarManager.SetToolBarState(toolbar1, ToolBarState.Floating);
74+
// Add buttons to the floating toolbar
75+
toolbar1.Items.Add(new Button
76+
{
77+
Content = new Image
78+
{
79+
Source = new BitmapImage(new Uri("Images/Save.png")),
80+
Stretch = Stretch.Uniform
81+
},
82+
Height = 40,
83+
Width = 40,
84+
ToolTip = "Save",
85+
Margin = new Thickness(5, 0, 5, 0)
86+
});
87+
// Set the ToolBarTrayAdv as the top tray for the ToolBarManager
88+
toolBarManager.TopToolBarTray = toolBarTray;
89+
// Set the ToolBarManager as the main content
90+
this.Content = toolBarManager;
7591

7692
{% endhighlight %}
7793

@@ -130,13 +146,13 @@ Following code restricts docking at the top:
130146

131147
{% endtabs%}
132148

133-
## ToolBar State Changed Event
149+
## ToolBarStateChanged event
134150

135-
ToolBarStateChanged event is triggered when the state of a ToolBarAdv changes, such as when it is hidden, floated, or docked. This event passes an instance of ToolBarStateChangedEventArgs, which contains information about the state change, including the old state and new state of the toolbar.
151+
The [ToolBarStateChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.Controls.ToolBarAdv.html#Syncfusion_Windows_Tools_Controls_ToolBarAdv_ToolBarStateChanged) event is triggered when the state of a ToolBarAdv changes, such as when it is hidden, floated, or docked. This event passes an instance of [ToolBarStateChangedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.Controls.ToolBarStateChangedEventArgs.html), which contains information about the state change, including the old state and the new state of the toolbar.
136152

137-
NewState: Gets the current state of the toolBarAdv control.
153+
NewState: Gets the current state of the ToolBarAdv control.
138154

139-
OldState: Gets the previous state of the toolBarAdv control.
155+
OldState: Gets the previous state of the ToolBarAdv control.
140156

141157
{% tabs %}
142158

@@ -147,13 +163,13 @@ OldState: Gets the previous state of the toolBarAdv control.
147163
<syncfusion:ToolBarTrayAdv >
148164
<syncfusion:ToolBarAdv ToolBarStateChanged="Toolbar1_ToolBarStateChanged" ToolBarName="Standard" Band="0">
149165
<Button syncfusion:ToolBarAdv.Label="Open Document"
150-
syncfusion:ToolBarAdv.Icon="Images/openHS.png">
151-
<Image Source="Images/openHS.png" Width="16" Height="16"/>
166+
syncfusion:ToolBarAdv.Icon="Images/Open.png">
167+
<Image Source="Images/Open.png" Width="16" Height="16"/>
152168
</Button>
153169
<syncfusion:ToolBarAdv Band="1" ToolBarName="Extras">
154-
<Button syncfusion:ToolBarAdv.Label="Insert Pictures"
155-
syncfusion:ToolBarAdv.Icon="Images/InsertPictureHS.png">
156-
<Image Source="Images/InsertPictureHS.png" Width="16" Height="16"/>
170+
<Button syncfusion:ToolBarAdv.Label="Save Document"
171+
syncfusion:ToolBarAdv.Icon="Images/Save.png">
172+
<Image Source="Images/Save.png" Width="16" Height="16"/>
157173
</Button>
158174
</syncfusion:ToolBarAdv>
159175
</syncfusion:ToolBarAdv>
@@ -174,7 +190,7 @@ OldState: Gets the previous state of the toolBarAdv control.
174190
{
175191
Content = new Image
176192
{
177-
Source = new BitmapImage(new Uri("Images\\OpenHS.png")),
193+
Source = new BitmapImage(new Uri("Images\\Open.png")),
178194
Stretch = Stretch.Uniform
179195
},
180196
Height = 40,
@@ -187,7 +203,7 @@ OldState: Gets the previous state of the toolBarAdv control.
187203
{
188204
Content = new Image
189205
{
190-
Source = new BitmapImage(new Uri("Images\\InsertPictureHS.png")),
206+
Source = new BitmapImage(new Uri("Images\\Save.png")),
191207
Stretch = Stretch.Uniform
192208
},
193209
Height = 40,

0 commit comments

Comments
 (0)