photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: Darius1968 on May 25, 2018, 05:40:53 AM

Title: Properly Formatted XAML
Post by: Darius1968 on May 25, 2018, 05:40:53 AM
Consider the following XAML code (used as an indicator for a layout): 

<Run Foreground='{File.Relations|hasvalue:#CCFFCC;default:#555555}'>V</Run>
<Run Foreground='{File.MD.Composite\GPSPosition\GPSPosition\0|hasvalue:#CCFFCC;default:#555555}'> G</Run>
<Run Foreground='{File.Stack.IsElement|hasvalue:true;is:1:#CCFFCC;default:#555555}'> S</Run>

There are effectively three modules for {File.Relations}, {File.MD.Composite\...}, and finally, {File.Stack.IsElement}.  The code is fine if I only make use of the 1st two modules.  However, when I add in the third, everything gets 'sabotaged'.  Can someone please tell me the correct code for {File.Stack.IsElement}?  That variable can either be "0", or "1", and I'm trying to test for the case, in which it is "1".  Thanks. 
Title: Re: Properly Formatted XAML
Post by: sinus on May 25, 2018, 08:16:31 AM
Darius,
tried only the third one.

This variable in my case:

{File.Stack.IsElement|is:1,jawohl,;pereplace:jawohl==<Image Source='file://c:\sinus-icons\memberstack-18.png'/>}

does show an icon, if the file is a stack-element.
If it is true, it is 1 and does write "jawohl" (could be also "nonsense") and later this "jawohl" is replaced by an icon in my case.
But you can use of course a text instead an icon.

See my attachement, where I have the result in a red rectangle. (the third image on the right is the top of the stack)
Title: Re: Properly Formatted XAML
Post by: Mario on May 25, 2018, 09:25:43 AM
When you paste the last row into the VarType app, you see that it returns

<Run Foreground='true'> S</Run>

which is not valid markup. You are mixing hasvalue and is and ....

Better use a simple numcomp (IsElement returns 1 if the file is part of a stack, 0 otherwise):

<Run Foreground='{File.Stack.IsElement|numcomp:eq,1,#CCFFCC,#555555}'> S</Run>