Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
XamGrid CellControl Behaviour
posted

Hi Guys,

I would like to set CellControl Behaviour to handle enter edit mode. I should set Behaviour from styles because I use the same column in many places. But it can create only one instance of behavior and I get the next error:http://prntscr.com/g8qlc9

Could you help me with that? Could you provide a sample project where Behaviour set from properties for CellControl type?

<utils:DataGridNameCellBehavior x:Key="XamGridNameCellBehavior"
x:Shared="False"
IsEditing="{Binding IsInEditMode, Mode=TwoWay}" />

<utilities:BehaviorCollection x:Key="XamGridNameCellBehaviors"
x:Shared="False">
<StaticResource ResourceKey="XamGridNameCellBehavior" />
</utilities:BehaviorCollection>

<Style x:Key="XamGridNameCellStyle"
TargetType="{x:Type ig:CellControl}">
<Setter Property="utilities:InteractionHelper.Behaviors"
Value="{StaticResource XamGridNameCellBehaviors}" />
</Style>

<ig:TemplateColumn Key="Name" x:Key="XamGridDetailGridNameColumn"
x:Shared="False"
CellStyle="{StaticResource XamGridNameCellStyle}"
IsReadOnly="True"
HeaderText="{x:Static properties:Resources.Name}">

Parents
No Data
Reply
  • 28945
    Offline posted

    Hello Andrey,

    Thank you for contacting Infragistics. Which platform are you using (eg. WPF or Silverlight). x:Shared would indicate you are using WPF, which should work outright. However you can work around this by embedding the behavior directly within your style rather than a static resource. The error you are receiving is to be excepted because a single instance o f your behavior is reused.

    eg.


    <Style x:Key="XamGridNameCellStyle"
    TargetType="{x:Type ig:CellControl}">

    <Setter Property="utilities:InteractionHelper.Behaviors" >

    <Setter.Value >
    <utils:DataGridNameCellBehavior  />
    </Setter.Value>

    </Setter>

    </Style>

    If you still require assistance please provide a sample that includes your InteractionHelper so I can investigate this further.

    Let me know if you have any questions regarding this matter.

Children