"data trigger using converter not working" Code Answer

4
<textblock 
        grid.column="1" 
        grid.row="1" 
        text="{binding path=gl, stringformat={}{0:n0}}" 
        horizontalalignment="left" 
        fontfamily="verdana"
        fontweight="bold"             
        verticalalignment="center"
        margin="5,2,5,0"
        fontsize="18"
        >
        <textblock.resources>
            <converters:colorconverter x:key="coconverter"></converters:colorconverter>
        </textblock.resources>
      <textblock.style>
          <style>
              <setter property="textblock.foreground" value="tomato" />
              <style.triggers>
                  <datatrigger binding="{binding relativesource={relativesource self}, path=text, converter={staticresource resourcekey=coconverter}}" value="true">
                  <setter property="textblock.foreground" value="limegreen" />
                      </datatrigger>
              </style.triggers>
          </style>
      </textblock.style>

you need to set the foreground property in your style to change it dynamically at runtime.

By Roy Miloh on October 10 2022

Answers related to “data trigger using converter not working”

Only authorized users can answer the Search term. Please sign in first, or register a free account.