Cannot add content to an object of type 'CXTPMarkupRun'

Started by Darius1968, May 07, 2022, 03:56:35 AM

Previous topic - Next topic

Darius1968

Consider the following two statements as entries in the File Window Tip: 

  • <Run Foreground='#cccccc' FontWeight='Normal' FontSize='10'>Hierarchal Keywords:</Run><LineBreak/>{File.MD.XMP::Lightroom\hierarchicalSubject\HierarchicalSubject\0|replace:~;==XXX;pereplace:XXX==<LineBreak/>}
  • <Run Foreground='#cccccc' FontWeight='Normal' FontSize='10'>Hierarchal Keywords:</Run><LineBreak/>{File.MD.XMP::Lightroom\hierarchicalSubject\HierarchicalSubject\0|prefix:<Run FontSize='9'>;replace:~;==XXX;pereplace:XXX==<LineBreak/>;postfix:</Run>}

The first one executes perfectly fine - Keywords of the file are enumerated in list form, as expected. 
However, in the 2nd case, instead of getting what I wanted - That same list of keywords, just with a smaller font size (9pt), I get in Preferences>File Window Tip>Test Tip:  "Cannot add content to an object of type 'CXTPMarkupRun'". 

So, what do I have to do to the 2nd statement, such that I get the desired output? 

Mario

Probably it is the LineBreak you try to add to your Run. This is not allowed AFAIK.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

So, with that in mind, do I have an alternative way of output that is both as a list and also whatever font size I want? 

Mario

See Formatting Output with XAML for information about how to use XAML in IMatch.
Please understand that I'm not a XAML specialist or consultant and I have never tried to stretch its limits, especially in combination with variables.

Use trial and error.
Start with plain XAML, no variables to see what the correct syntax must be. Then add your variable.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Check out Kaxaml -> https://kaxaml.software.informer.com/1.8/ for a nice XAML editor and renderer... it gets the job done!

Mario

Keep in mind that the XAML implementation used by IMatch is provided by the 3rd party user interface library and that it supports only a subset of XAML (as shown in the IMatch Help).

The Preview feature in the File Window Top configuration usually does a good job of telling what the problem is if the user produces invalid XAML.
Together with variables and their default behavior to escape special characters to avoid breaking the UI, things can get a bit challenging if the user attempts to do too much.
This is mostly for simply changing font sizes and colors in the File Window tip, not for doing paragraph formatting and whatnot.

As I said, you cannot include a <LineBreak/> inside a <Run>. <Run> cannot contain other objects, only Cursor, Background, Foreground, TextDecorations, FontSize, FontWeight, FontFamily, FontStyle, BaselineAlignment, Text
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook