Hi,
I'm trying to change the style of the Header of all Tiles in code-behind. I've come across the TileHeaderPresenter class, but I don't know to which property of the xamTilesControl I should assign that object?
Kind regards,Stijn
Hi Stijn,
If you want the style to apply to all tiles and you are creating it in code then you can insert it into the XamTilesControl's Resources dictionary keyed by the type TileHeaderPresenter. It should get picked up for all tiles.
If you want to target a specify tile you could insert it into the Resources of that specific tile again keyed by the type TileHeaderPresenter.
Thank you for the information. However, it isn't clear to me what you mean with "keyed by the type TileHeaderPresenter", since the Add() method of the Resources dictionary requires the key to be passed as an object.
TileHeaderPresenter tileHeaderPresenter = new TileHeaderPresenter();tileHeaderPresenter.Background = Brushes.Red;
//does not seem to workthis.patientDashboardTilesControl.Resources.Add("TileHeaderPresenter", tileHeaderPresenter);
//does not seem to workthis.patientDashboardTilesControl.Resources.Add(new TileHeaderPresenter(), tileHeaderPresenter);
//compile errorthis.patientDashboardTilesControl.Resources.Add(TileHeaderPresenter, tileHeaderPresenter);
//runtime error (cannot convert Infragistics.Windows.Tiles.TileHeaderPresenter to System.Windows.Style)this.patientDashboardTilesControl.Resources.Add(tileHeaderPresenter.GetType(), tileHeaderPresenter);
//runtime error (cannot convert Infragistics.Windows.Tiles.TileHeaderPresenter to System.Windows.Style)this.patientDashboardTilesControl.Resources.Add(new TileHeaderPresenter().GetType(), tileHeaderPresenter);
(patientDashboardTilesControl is a xamTilesControl )
Another lesson learned, much appreciated.
Try this:
Style
style.TargetType = typeof(TileHeaderPresenter);
style
));
this
);