We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Image in chromeless wpf window title

I'd like to know if I can use an image in the chromeless wpf window bar instead the standard icon, like the application "Syncfusion Metro Studio 5".
Thanks!

12 Replies

SM Sugapriya Mariappan Syncfusion Team July 1, 2016 09:13 AM UTC

Hi Gianni,

Thank you for contacting Syncfusion Support.

We have prepared a sample based on your update.In this sample we have set Icon for the ChromelessWindow using the “Icon” property

Sample:ChromelessWindowSample

If your requirement is different from this sample, please provide more information about your requirement

Regards,
M.Sugapriya



UN Unknown Syncfusion Team July 1, 2016 01:57 PM UTC

I know how to use icon property but I meant an image like your Syncfusion Metro Studio 5, see the image below:

Image in title bar


UN Unknown Syncfusion Team July 1, 2016 03:01 PM UTC

Ok, working around ChromelessWindow_137910 example I was able to add images to title bar using the resourceDirectory ControlTemplate definition for TitleBarTemplate.
Is it the right way?
Thanks!


UN Unknown Syncfusion Team July 1, 2016 03:57 PM UTC

I've created my custom ChromelessWindow template, on design I can view my template right and I'm able to compile but when I run the application I receive an exception:
Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
See the screen shot below:
ScreenShotChromelessException.jpg
Any idea to fix it?
Thanks!


VR Venkateshwaran Ramdoss Syncfusion Team July 4, 2016 03:33 PM UTC

Hi Gianni,

We have prepared a sample based on your requirement. In this sample we have edit the ChromelessWindow Template by using ControlTemplate. Please download the sample from the below link.

Sample: ChromelessWindowSample

Regards,
Venkateshwaran V.R.


UN Unknown Syncfusion Team July 5, 2016 10:06 AM UTC

Thanks for your help but I'm struggling to fix this!
I've replicated your example in my project, I'm able to see right the ChromelessWindow template at design time but when I execute my project I receive an XamlParseException exception .
I've also tried to load your template without any modification in my project but when I add the line Template="{StaticResource ChromelessWindowTemplate}" in MainWindow.xaml I receive the same exception!


Link to the screenshot
 


UN Unknown Syncfusion Team July 5, 2016 10:29 AM UTC

This is the details of the exception (it seems a problem around titlebar element):

System.Windows.Markup.XamlParseException verificata
  HResult=-2146233087
  LineNumber=11
  LinePosition=9
  Message='È stata generata un'eccezione durante la specifica di un valore su 'System.Windows.StaticResourceExtension'.' numero riga '11' e posizione riga '9'.
  Source=PresentationFramework
  StackTrace:
       in System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       in System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       in System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       in System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       in Codepoint.EasyWarehouse.WpfRegistrationUtility.MainWindow.InitializeComponent() in C:\Users\Ricky\Documents\TFS Repos\WpfRegistrationUtility\MainWindow.xaml:riga 1
  InnerException:
       HResult=-2146233088
       LineNumber=0
       LinePosition=0
       Message=Record imprevisto nel flusso Baml. Tentativo di aggiungere a TitleBar che non è una raccolta o ha un TypeConverter.
       Source=PresentationFramework
       StackTrace:
            in System.Windows.Baml2006.Baml2006Reader.InjectPropertyAndFrameIfNeeded(XamlType elementType, SByte flags)
            in System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
            in System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
            in System.Windows.Baml2006.Baml2006Reader.ReadObject(KeyRecord record)
            in System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
            in System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
            in System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
            in System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
            in System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
            in System.Windows.ResourceDictionary.FetchResource(Object resourceKey, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean canCacheAsThemeResource, Boolean& canCache)
            in System.Windows.FrameworkElement.FindResourceInternal(FrameworkElement fe, FrameworkContentElement fce, DependencyProperty dp, Object resourceKey, Object unlinkedParent, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, DependencyObject boundaryElement, Boolean isImplicitStyleLookup, Object& source)
            in System.Windows.StaticResourceExtension.FindResourceInAppOrSystem(IServiceProvider serviceProvider, Boolean allowDeferredReference, Boolean mustReturnDeferredResourceReference)
            in System.Windows.StaticResourceExtension.FindResourceInEnviroment(IServiceProvider serviceProvider, Boolean allowDeferredReference, Boolean mustReturnDeferredResourceReference)
            in System.Windows.StaticResourceExtension.TryProvideValueInternal(IServiceProvider serviceProvider, Boolean allowDeferredReference, Boolean mustReturnDeferredResourceReference)
            in System.Windows.StaticResourceExtension.ProvideValueInternal(IServiceProvider serviceProvider, Boolean allowDeferredReference)
            in System.Windows.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider)
            in MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
       InnerException:


VR Venkateshwaran Ramdoss Syncfusion Team July 6, 2016 11:49 AM UTC

Hi Gianni,

We can directly set the ChromlessWindow Template. We have prepared a sample which can be downloaded from the below link.

Sample: ChromelessWindowSample

Please ensure whether all ControlTemplate of ResourceDictionary in App.xaml are used as in our sample.

Regards,
Venkateshwaran V.R. 



UN Unknown Syncfusion Team August 11, 2016 01:07 PM UTC

Very Thanks! This sample is very useful and It allowed me to customize in detail my chromeless windows bar but I've some problem adding control on the windows.
For example if you try to add a SFDataGrid control to your above example it give exceptions and is no more possible to run it.
Can you explain me please the needed step to add other controls into the templated chromeless window.
Surely I missed something but don't understand what!
Thanks!


SM Sugapriya Mariappan Syncfusion Team August 12, 2016 07:23 AM UTC

HI Gianni,

We have modified our last updated sample to meet your requirement. In this sample we have added SfDataGrid control to our ChromelessWindow.

Please download the modified sample from the below link
Sample:ChromelessWindowSample

Could you please check the sample and let us know the result?

Regards,
M.Sugapriya



UN Unknown Syncfusion Team August 12, 2016 01:08 PM UTC

Thanks, I've solved.
Adding controls directly from toolbox often is added bad dll version that do not match the targeting of the project and it causes problems and incomprehensible behavior.
The only workaround is to be careful and manually add all the necessary dll for each SF control before add it on the project.


SM Sugapriya Mariappan Syncfusion Team August 15, 2016 05:31 AM UTC

Hi Gianni,

Thank you for your update.

Please let us know if you need any other assistance

Regards,
M.Sugapriya


Loader.
Live Chat Icon For mobile
Up arrow icon