I need to bind to something in the style for an Editor that will do something different if the Editor is in a read-only column vs an editable column. If there isn't anything on editor, is there something on the CellValuePresenter that contains the editor?
I tried IsReadOnly, but it seems to always be false.
<Style TargetType="{x:Type editors:XamTextEditor}" x:Key="SomeKey"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <TextBlock/> <ControlTemplate.Triggers> <Trigger Property="IsReadOnly" Value="False"><!-- what tells me if the editor is in a read-only column or not?--> <Setter Property="SomeProperty" Value="False"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter>
Hello,
You can use the IsInEditMode property. It will be always false if you have a read-only field.
I'm trying to do this in the Template, not the EditTemplate. So yes, it will always be false for everything - which doesn't help. I'm trying to differentiate between a ready-only column and an editable column (basically I'm going to show/hide something depending on if the column can go into edit mode or not).
You could create a binding with a RelativeSource - FindAncestor, AncestorType - CellValuePresenter and a Path - Field.AllowEditResolved.
That's what I needed. Thanks!