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
935
Update Field within
posted

I have a textbox withing a template that is not updating. I have forced update thru code behind, but that is far from ideal. Here is the template:

<Style x:Key="CellPresenterButtonTextbox"
 TargetType="{x:Type igDP:CellValuePresenter}"
 BasedOn="{StaticResource {x:Type igDP:CellValuePresenter}}">
<Style.Resources>
</Style.Resources>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<Grid>
<Button Name="AggregationButton"
HorizontalAlignment="Stretch"
Margin="2,.5"
Padding="4,0"
Height="20"
Command="{Binding DataContext.DataItem.CommandInterface, RelativeSource={RelativeSource Self}}"
CommandParameter="Aggregate"
Visibility="Hidden">
<TextBlock Text="Aggregate"
 FontWeight="Black"
 FontSize="10" />
</Button>
<TextBox Name="BasketTextBox"
 HorizontalAlignment="Stretch"
 VerticalAlignment="Stretch"
 Background="#FF222222"
 Foreground="White"
 Margin="2,.5"
 Text="{TemplateBinding Content}"
 LostFocus="UpdateStrategy"
 Visibility="Hidden" />
</Grid>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding DataContext.DataItem.Type, RelativeSource={RelativeSource Self}}"
 Value="Aggregation">
<Setter Property="Visibility"
TargetName="BasketTextBox"
Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.DataItem.Type, RelativeSource={RelativeSource Self}}"
 Value="Basket">
<Setter Property="Visibility"
TargetName="AggregationButton"
Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

Here is the Field:

 <igDP:Field Name="Strategy"
Label="Strategy"
Width="72">
<igDP:Field.Settings>
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource CellPresenterButtonTextbox}"
CellClickAction="EnterEditModeIfAllowed"
AllowEdit="True" />
</igDP:Field.Settings>
</igDP:Field>

As I said have it working with code behind, but not a good situation.

  • 30945
    Verified Answer
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and if I understand correctly, the issue that you are having is that the property that of your data object is not updated when the text in the TextBox is changed. If this is correct, I can suggest binding the Text property of the TextBox to the Value property of the CellValuePresenter, with a RelativeSource binding. I have created a sample application for you, using the code snippet that you have provided, in order to demonstrate the approach I have suggested.

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

    CellContentUpdate.zip