Page 1 of 1

Customize the WpfDesigner

Posted: Thu Jan 10, 2013 11:47 am
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;
}

Re: Customize the WpfDesigner

Posted: Fri Jan 11, 2013 9:45 am
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.

Re: Customize the WpfDesigner

Posted: Sat Jan 12, 2013 7:07 pm
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.

Re: Customize the WpfDesigner

Posted: Sat Jan 12, 2013 7:17 pm
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.

Re: Customize the WpfDesigner

Posted: Sun Jan 13, 2013 8:00 pm
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...

Re: Customize the WpfDesigner

Posted: Mon Jan 14, 2013 11:27 am
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.

Re: Customize the WpfDesigner

Posted: Mon Jan 14, 2013 9:29 pm
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?

Re: Customize the WpfDesigner

Posted: Tue Jan 15, 2013 8:30 am
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.