The WPF DataGrid column shows the 0,-1 (void, delete) status, the type of (expense, income), the operator (in other tables), and how to convert the format.

Source: Internet
Author: User
Tags wpf datagrid

operator, leftist, Join on LETF//Allow me to add.

State, type, similar conversion, introduced in xmlns Common xmlns:com= "Clr-namespace:xxx.common",

In <UserControl.Resources> Xkey binding statusconvert (state transition) is the Converter={staticresource St of the column binding that needs to be converted in XAML Atusconvert}

In common, Cconvert class, the public class Statusconvert is defined to implement the IValueConverter interface:

  Public ObjectConvert (ObjectValue, Type TargetType,Objectparameter, System.Globalization.CultureInfo culture) {            if(Value = =NULL)            {                returnvalue; }            varresult = Clisthelper.statuslist. Where (c = C.selectvalue = =value. ToString ()). FirstOrDefault (); The collection defined in//clistheiper is used here. ext: B  if(Result! =NULL)            {                returnresult.            Displayvalue; }            returnValue
}

 Public Object Convertback (objectobject  parameter, System.Globalization.CultureInfo culture)        {             thrownew  notimplementedexception ();        }

B:

    Public StaticObservablecollection<clistmodel> statuslist {Get            {                if(_statuslist = =NULL) {_statuslist=NewObservablecollection<clistmodel>(); _statuslist.add (NewClistmodel () {displayvalue ="Normal", Selectvalue ="0" }); _statuslist.add (NewClistmodel () {displayvalue ="void", Selectvalue ="-1" }); }                return_statuslist; }        }

The WPF DataGrid column shows the 0,-1 (void, delete) status, the type of (expense, income), the operator (in other tables), and how to convert the format.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.