
I am trying to customise the RecentDocumentMenu control.
From my account I have downloaded the default XAML styles. Including, then editing the Menu.xaml
does achieve what I want. However having such a large amount of Actipro source code in our codebase is something I'd like to avoid for future maintainance reasons.
I have been trying to modify the PART_Button
named Grid
element within the LargeRecentDocumentButtonStyle
style.
I have tried the following from within a derrived class of RecentDocumentMenu
:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var grid1 = this.FindName("PART_Button");
var grid2 = this.GetTemplateChild("PART_Button");
var grid3 = base.FindName("PART_Button");
var grid4 = base.GetTemplateChild("PART_Button");
var grid5 = this.Template.FindName("PART_Button", this);
var grid6 = base.Template.FindName("PART_Button", this);
var grid7 = LogicalTreeHelper.FindLogicalNode(this, "PART_Button");
var grid8 = GetTemplateChild("PART_Button");
I have tried the following from within the containing view:
private void FrameworkElement_OnLoaded(object sender, RoutedEventArgs e)
{
var control = sender as RecentDocumentMenuCustomised;
var grid0 = control?.FindName("PART_Button");
var grid00 = control?.Template.FindName("PART_Button", control);
var grid1 = this.FindName("PART_Button");
var grid2 = this.GetTemplateChild("PART_Button");
var grid3 = base.FindName("PART_Button");
var grid4 = base.GetTemplateChild("PART_Button");
var grid5 = this.Template.FindName("PART_Button", this);
var grid6 = base.Template.FindName("PART_Button", this);
var grid7 = LogicalTreeHelper.FindLogicalNode(this, "PART_Button");
var grid8 = GetTemplateChild("PART_Button");
All with no success, every gridX
result is null
.
Could you tell me the best way to proceed?