Learn the use of IValueConverter (DataGrid)

The WPF framework provides an IValueConverter interface, which is responsible for customizing the conversion logic when the data source is bound to the data control. Using it includes the following steps:

1. Create a value converter class to implement the interface;

2. Add ValueConversion attribute to this class, and formulate source type and target type;

3. Two methods to implement the interface, Convert() and ConvertBack()

4. After creating the class according to 1-3, in the data binding control, set the Converter as an instance of the class;

--------------------------------------------------------------------------------

http://www.cnblogs.com/horan/archive/2012/02/27/2368262.html

http://www.cnblogs.com/-ShiL/archive/2013/03/14/Star201303141456.html

 http://www.suchso.com/projecteactual/wpf-jiaocheng-IValueConverter-DataGrid-change.html

--------------------------- -------------------------------------------------- --------
1: Space reference
xmlns:cvt="clr-namespace:PCR_03RLS_Host"

2: Resource declaration
   
       

   
3. Add binding
                                   
                                   


                                    
                                       
                                           
                                       
                                   

                                                                      
                                   
                                   
                      

Guess you like

Origin blog.csdn.net/lm393485/article/details/88892355