Ronald Brill Posted December 10, 2023 Share Posted December 10, 2023 I have implemented a CustomValueRenderer that converts text into a graphic. Works fine so far. But the graphic requires larger cells to be readable.Therefore i like to change the column width and the cell height (for all cells) at best at the moment the cell renderer for a column is switched to my one.Any chance to do this from my C# code? Link to comment Share on other sites More sharing options...
Andreas Laestadius Posted December 11, 2023 Share Posted December 11, 2023 Hi,This may or may not work, but worth a try.// Get the parent table plot of your custom rendererplot = render.GetAncestor<TablePlot>(); // Set the row heightplot.RowHeight = <numeric here>;Let me know if this works for you! Link to comment Share on other sites More sharing options...
Ronald Brill Posted December 11, 2023 Author Share Posted December 11, 2023 Hi Andreas,thanks for the fast answer.Maybe i'm wrong but CustomValueRenderer does not provide something like GetAncestor().And looking at the argumens of RenderCore() seems to also not provide anything in this direction. Link to comment Share on other sites More sharing options...
Andreas Laestadius Posted December 11, 2023 Share Posted December 11, 2023 Ah, perhaps if you listen events on TableColumnCollection.PropertyNames.ValueRenderersfor changes, you might be able pick up on the addition of a value renderer. You might have to set this up earlier in the doc creation tho. Link to comment Share on other sites More sharing options...
Ronald Brill Posted December 11, 2023 Author Share Posted December 11, 2023 Next stupid question....Wrote a CustomApplicationEventHandler. The handler is triggered and the AddEventHandler method is called when open a new document.But my method ValueRenderersChanged() is never called. public class ContentTypeDetectEventHandler : CustomApplicationEventHandler { private static ExternalEventManager externalEventManager = new ExternalEventManager(); protected override void OnApplicationInstanceCreated(AnalysisApplication application) { base.OnApplicationInstanceCreated(application); application.DocumentChanged += (obj, eventArgs) => { AnalysisApplication app = obj as AnalysisApplication; if (app == null || app.Document == null) { return; } externalEventManager.AddEventHandler( ValueRenderersChanged, Trigger.CreatePropertyTrigger(app.Document, TableColumnCollection.PropertyNames.ValueRenderers)); }; } public void ValueRenderersChanged() { } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now