Note that there are some explanatory texts on larger screens.

plurals
  1. POIn WPF can I manually "reset" or re-test the triggers for a Style?
    primarykey
    data
    text
    <p>What I want to do is 're-test' a <code>Trigger</code> when an event is fired. This is because the <code>Trigger</code> is binding to the <code>Row.RowState</code> property of a <code>DataRowView</code>, which does NOT fire the <code>PropertyChanged</code> notification required the for trigger to re-evaluate its condition.</p> <p>(see the post at the bottom of this page: <a href="https://stackoverflow.com/questions/4947918/wpftoolkit-datagrid-highlight-modified-rows/4948029#4948029">WpfToolkit DataGrid: Highlight modified rows</a>)</p> <p>I can re-set a <code>Trigger</code> on a per-control basis in an event like so:</p> <pre><code> private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { Style s = ((TextBox)sender).Style; ((TextBox)sender).Style = null; ((TextBox)sender).Style = s; } </code></pre> <p>But I have a <code>DataGrid</code> with many controls and which all use one of four <code>Style</code>s. What I would like to do is do something like, in psuedo code:</p> <pre><code>Style1.reTest(); Style2.reTest(); ... </code></pre> <p>Is there any way to do that? The first problem is that you can't name styles, so accessing them externally to the xmlns is problematic. The second problem is that a <code>Style</code> does not have a method which provides this functionality.</p> <p>Any help most apppreciated.</p> <p>EDIT 1: I can get the styles using the resource dictionary (can't believe I hadn't thought of it, I assumed they wouldn't be in there because I hadn't named them). If you haven't named them you can grab them like this (changing the type obviously): </p> <pre><code>Style s = (Style)Resources[typeof(System.Windows.Controls.TextBox)]; </code></pre> <p>Edit2: I have found the answer and will post it when Stackoverflow allows me to. Many thanks for all the responses :)</p> <p>Fugu</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload