|
@@ -120,19 +120,23 @@ public partial class SecondaryWindow : RibbonWindow, IPanelHostControl
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
public void CreatePanelAction(PanelAction action)
|
|
|
{
|
|
|
- var button = new Button
|
|
|
+ var button = new Fluent.Button
|
|
|
{
|
|
|
Header = action.Caption,
|
|
|
- LargeIcon = action.Image.AsBitmapImage()
|
|
|
+ LargeIcon = action.Image?.AsBitmapImage(),
|
|
|
+ MinWidth = 60
|
|
|
};
|
|
|
+ button.Bind<PanelAction, String>(Fluent.Button.HeaderProperty, x=>x.Caption, null);
|
|
|
+ button.Bind<PanelAction, Bitmap>(Fluent.Button.LargeIconProperty, x => x.Image, new BitmapToBitmapImageConverter());
|
|
|
+ button.Bind<PanelAction, ContextMenu?>(Fluent.Button.ContextMenuProperty, x=>x.Menu);
|
|
|
+ button.Bind<PanelAction, bool>(Fluent.Button.IsEnabledProperty, x => x.IsEnabled);
|
|
|
+ button.Bind<PanelAction, Visibility>(Fluent.Button.VisibilityProperty, x => x.Visibility);
|
|
|
+ button.DataContext = action;
|
|
|
button.Click += (o, e) => action.Execute();
|
|
|
- if (action.Menu is not null)
|
|
|
- {
|
|
|
- button.ContextMenu = action.Menu;
|
|
|
- }
|
|
|
Actions.Items.Add(button);
|
|
|
CurrentModules.Add(button);
|
|
|
ActionsSeparator.Visibility = Visibility.Visible;
|