Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
89
Question about customising ContentPane Header
posted

Hi

I have a XamDocManager that contains SplitPanes, the last ones contain ContainPanes.

I need to cusomize the Header of the ContentPane. Actually I need to add two buttons that should appear right after the basic ones(close, hide etc) and they should be very similar to them (i.e. there should be two add buttons like "+" that will have the same style). At the end I need to do this programatically. Now I have successed with adding buttons but they looks awfully :)

Here the code I have:

 

DataTemplate GetHeaderTemplate()

{

FrameworkElementFactory headerContainerElement = new FrameworkElementFactory(typeof(WrapPanel));

FrameworkElementFactory labelElement = new FrameworkElementFactory(typeof(TextBlock));

labelElement.SetValue(TextBlock.TextProperty, "Title");

headerContainerElement.AppendChild(labelElement);

 

FrameworkElementFactory addServiceButton = new FrameworkElementFactory(typeof(Button));

addServiceButton.SetValue(Button.ContentProperty, "Add Service");

addServiceButton.AddHandler(Button.ClickEvent, new RoutedEventHandler((o, e) => { AddServiceToGroup(group, groupControl); }));

headerContainerElement.AppendChild(addServiceButton);

 

FrameworkElementFactory addCounterButton = new FrameworkElementFactory(typeof(Button));

//addCounterButton.SetValue(Button.StyleProperty, (Style)FindResource("AddMonitoringElemntButtonStyle"));

addCounterButton.SetValue(Button.ContentProperty, "Add Counter");

addCounterButton.AddHandler(Button.ClickEvent, new RoutedEventHandler((o, e) => { AddCounterToGroup(group, groupControl); }));

headerContainerElement.AppendChild(addCounterButton);

DataTemplate headerTemplate = new DataTemplate();

headerTemplate.VisualTree = headerContainerElement;

return headerTemplate;

}

 

and then assign it to the ContentPaneHeaderTemplate.

Thats work fine however the question is about the style.

And one more here: is it possible to add the new item to the ContentPane.Header menu (i.e. Hide, Floating, ... and my items next)

 

Thanks for answers