Changing Icon of PrintingService Dialog in SfDiagram
Hi Joost van Gils,
Greetings from Syncfusion.
We can change the icon of the Print Preview dialog by updating PrintPreviewWindow’s Icon property as below:
|
<Application x:Class="SfDiagram_Sample.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:diagramControls="clr-namespace:Syncfusion.UI.Xaml.Diagram.Controls;assembly=Syncfusion.SfDiagram.WPF" StartupUri="MainWindow.xaml"> <Application.Resources> <Style TargetType="diagramControls:PrintPreviewWindow"> <Setter Property="Icon" Value="/SfDiagram
Sample;component/App.ico"/> </Style> </Application.Resources> </Application> |
Regards,
Prakash
P
SfSkinManager.SetTheme(this, theme);
Thanks again for the example. I've examined it and concluded I was using the code in the right way.
Now I think I've found a bug.
This is the case: the code is working in the proper way when I don't apply any Theme to the entire application.
In my case I'm using the Office2019Black theme. The theme is set in this way at right after the InitializeComponent() of the main window:
Theme theme = new Theme("Office2019Black");
SfSkinManager.ApplyStylesOnApplication = true;
SfSkinManager.SetTheme(this, theme);
and after this is set and I call this:
MainDiagram.PrintingService.ShowDialog = true;
MainDiagram.PrintingService.Print();
the SyncFusion Icon will be shown on the PrintPreview Dialog instead of the Icon that is set in the App.xml.
Regards,
Joost
|
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Syncfusion.Themes.Office2019Colorful.WPF;component/SfDiagram/SfDiagram.xaml"/>
<ResourceDictionary Source="/Syncfusion.Themes.Office2019Colorful.WPF;component/PrintPreview/PrintPreview.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="diagramControls:PrintPreviewWindow" BasedOn="{StaticResource SyncfusionPrintPreviewWindowStyle}">
<Setter Property="Icon" Value="/Simple SfDiagram WPF;component/Asset/Symbol.png"/>
</Style>
</ResourceDictionary>
</Application.Resources>
|
|
<Application.Resources>
<Style TargetType="syncfusion:ChromelessWindow" x:Key="PrintWindowStyle">
<Setter Property="Icon" Value="..\..\print.png"/>
<Setter Property="Title" Value="Print Preview"/>
</Style>
</Application.Resources>
this.dataGrid.PrintSettings.PrintPreviewWindowStyle = App.Current.Resources["PrintWindowStyle"] as Style; |
Thanks for the update.
Your requirement can be achieved by Adding the ResourceDictionary of MaterialLight Theme in SfDataGrid. Basedon property binded with SyncfusionChromelessWindowStyle as StaticResource defined in Style. Please refer the below code snippet,
|
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Syncfusion.Themes.MaterialLight.WPF;component/GridPrintPreviewControl/GridPrintPreviewControl.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="syncfusion:ChromelessWindow" x:Key="PrintWindowStyle" BasedOn="{StaticResource SyncfusionChromelessWindowStyle}">
<Setter Property="Icon" Value="..\..\print.png"/>
<Setter Property="Title" Value="Print Preview"/>
</Style>
</ResourceDictionary>
</Application.Resources> |
Regards,
Vijayarasan S
|
dataGrid.PrintSettings.PrintManagerBase = new CustomPrintManager(this.dataGrid);
this.dataGrid.PrintSettings.PrintPreviewWindowStyle = App.Current.Resources["PrintWindowStyle"] as Style;
this.dataGrid.PrintSettings.AllowPrintByDrawing = false;
this.dataGrid.PrintSettings.AllowPrintStyles = false;
this.dataGrid.ShowPrintPreview();
public class CustomPrintManager : GridPrintManager
{
public CustomPrintManager(SfDataGrid grid)
: base(grid)
{
}
protected override object GetColumnElement(object record, string mappingName)
{
var columnElement = base.GetColumnElement(record, mappingName) as TextBlock; if (columnElement != null)
{
columnElement.Foreground = new SolidColorBrush(Colors.Blue);
}
return columnElement;
}
protected override UIElement GetColumnHeaderElement(string mappingName)
{
var columnElement = base.GetColumnHeaderElement(mappingName) as TextBlock; if (columnElement != null)
{
columnElement.Foreground = new SolidColorBrush(Colors.Blue);
}
return columnElement;
}
} |
- 12 Replies
- 6 Participants
- Marked answer
-
JV Joost van Gils
- Mar 22, 2021 06:31 PM UTC
- Apr 12, 2021 01:50 PM UTC