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
695
Change cell value conditionally.
posted

I have the following scenario:

I am trying to change the value of a cell by using a custom presenter (see below for the XAML). My custom presenter is being hit but the grid is not showing the new value returned by the cusom converter. Can someone point out what i am doing wrong? 

<Style x:Key="cvpValueChange" TargetType="{x:Type igDP:CellValuePresenter}">

<Setter Property="Value" Value="{Binding RelativeSource={RelativeSource Self}, Path=Value, Converter={StaticResource cvpValueConverter}}"/>

</Style>

Parents
  • 8576
    Verified Answer
    Offline posted
    Hi Martin -
     
    You are trying to bind the CellValuePresenter's Value property to itself - this will not work. 
     
    The way to do this is to add a Setter for the Template property to the CellValuePresenter style, which sets the proeprty to a Template containing an element (e.g., a ContentControl) that binds to the Value property using the converter.  I have attached a simple project that demonstrates this.
     
    Joe Modica
     
    WpfApplication10.zip
Reply Children