Customize the WpfDesigner

Stimulsoft Reports.WPF discussion
Post Reply
RDR_Norkart
Posts: 46
Joined: Thu Jan 10, 2013 11:40 am

Customize the WpfDesigner

Post by RDR_Norkart »

We try to customize the WpfDesigner.

These 2 options work fine:
StiOptions.Designer.CodeTabVisible = false;
StiOptions.Designer.DontAskSaveReport = true;
But these 2 don't work:
StiOptions.Designer.MainMenu.ShowFileReportSaveAs = false;
StiOptions.Designer.MainMenu.ShowFileReportNew = false;

Here some more code:

private void ButtonClick(object sender, RoutedEventArgs e)
{
SetDesignerOptions();
var report = new StiReport();
report.DesignWithWpf();
}

private static void SetDesignerOptions()
{
StiOptions.Designer.CodeTabVisible = false;
StiOptions.Designer.DontAskSaveReport = true;

StiOptions.Designer.MainMenu.ShowFileReportSaveAs = false;
StiOptions.Designer.MainMenu.ShowFileReportNew = false;
}
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Customize the WpfDesigner

Post by HighAley »

Hello.

If you use Ribbon intarface then you should use next code:

Code: Select all

private void ButtonClick(object sender, RoutedEventArgs e)
{
SetDesignerOptions();
var report = new StiReport();
report.DesignWithWpf();
}

private static void SetDesignerOptions()
{
StiOptions.Designer.CodeTabVisible = false;
StiOptions.Designer.DontAskSaveReport = true;

StiOptions.Designer.Ribbon.ShowMainMenuReportSaveAs = false;
StiOptions.Designer.Ribbon.ShowMainMenuReportNew = false;
}
Thank you.
RDR_Norkart
Posts: 46
Joined: Thu Jan 10, 2013 11:40 am

Re: Customize the WpfDesigner

Post by RDR_Norkart »

Ok, it works. tank you.

But, I also want to hide some properties for the user:

I try this:
StiOptions.Designer.Panels.Dictionary.ShowPropertiesForDataConnection = false;
StiOptions.Designer.Panels.Dictionary.ShowPropertiesForDataSource = false;

and this:

StiServiceContainer container = StiConfig.Services.GetServices(typeof(StiWpfPanelService));
foreach (StiService service in container)
{
if (service is StiWpfDictionaryPanelService)
_dictionaryPanelService = service as StiWpfDictionaryPanelService;
}
_dictionaryPanelService.ShowPropertiesForDataConnection = false;
_dictionaryPanelService.ShowPropertiesForDataSource = false;
_dictionaryPanelService.ShowPropertiesForDataParameter = false;
_dictionaryPanelService.ShowPropertiesForDataRelation = false;
_dictionaryPanelService.ShowPropertiesForDataColumn = false;

But I can't get it to work.
RDR_Norkart
Posts: 46
Joined: Thu Jan 10, 2013 11:40 am

Re: Customize the WpfDesigner

Post by RDR_Norkart »

This does not work:

_designerControl = new StiWpfDesignerControl();
_designerControl.ShowPanelDictionary = false;
_designerControl.ShowPanelProperties = false;

Where could I find an up-to-data example or up-to-date documentation about this.
RDR_Norkart
Posts: 46
Joined: Thu Jan 10, 2013 11:40 am

Re: Customize the WpfDesigner

Post by RDR_Norkart »

A bit confusing.
What should I use to hide the "New Connection" menuitem in the Dictionary?

_designerControl = new StiWpfDesignerControl();

this?
_designerControl.DictionaryPanelService.ShowConnectionNewMenuItem = false;

or this?
StiOptions.Designer.Panels.Dictionary.ShowConnectionNewMenuItem = false;

I can't figure it out...
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Customize the WpfDesigner

Post by HighAley »

Hello.

All properties works. It's better to use them:

Code: Select all

StiOptions.Designer.Panels.Dictionary.ShowPropertiesForDataConnection = false;
StiOptions.Designer.Panels.Dictionary.ShowPropertiesForDataSource = false;
StiOptions.Designer.Panels.Dictionary.ShowConnectionNewMenuItem = false;
Thank you.
RDR_Norkart
Posts: 46
Joined: Thu Jan 10, 2013 11:40 am

Re: Customize the WpfDesigner

Post by RDR_Norkart »

Thank you Aleksey!
Now I understand that the best place to put this is before the window's InitializeComponent();

Like this:

public MainWindow()
{
InitializeDesigner();
InitializeComponent();
}
This helped me a lot!

I saw that it's possible to add a button to a toolbar.
But is this also possible for the Wpf-Ribbon-Designer?
On the Ribbon or maybe at a place in the Mainmenu?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Customize the WpfDesigner

Post by HighAley »

Hello.
RDR_Norkart wrote:Now I understand that the best place to put this is before the window's InitializeComponent();

Like this:

public MainWindow()
{
InitializeDesigner();
InitializeComponent();
}
This helped me a lot!
The settings are reading at initialize time.
RDR_Norkart wrote:I saw that it's possible to add a button to a toolbar.
But is this also possible for the Wpf-Ribbon-Designer?
On the Ribbon or maybe at a place in the Mainmenu?
It's impossible to add a button in the Designer in source code only.

Thank you.
Post Reply