Format the value of the ComboBox pulled from the SQL database (LINQ) in Project C # (WPF)

3

I need a help in the code below ... I need to get the SQL database float value to be in the Brazilian Real Number Set format in a C # (WPF) project in a ComboBox (such as Double). That is, bring it as String in the IntemsSource and not be in this format "0.000", but in this "0.000".

Code:

var query_Fardo = from f in oDB.tabProdutos 
                  where f.Codigo == Convert.ToInt32(txtCodigoApontaPrd.Text) 
                  select f.Fardo;
CmBox_FardoApontaPrd.ItemsSource = query_Fardo;
CmBox_FardoApontaPrd.ItemStringFormat = "0,000";//Não funciona

Thanks for the support ...

    
asked by anonymous 25.03.2016 / 14:10

1 answer

0

I did not understand if I wanted the type to be Double , but it follows a response transforming it to string :

var query_Fardo = from f in oDB.tabProdutos 
                  where f.Codigo == Convert.ToInt32(txtCodigoApontaPrd.Text) 
                  select f.Fardo.ToString("#,###.###");

With this, it would not be necessary

  

CmBox_FardoApontaPrd.ItemStringFormat="0.000";

    
26.03.2016 / 16:37