1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| public void CreeGridview()
{
GridView myGridView = new GridView();
#region Colonne Libelle
if (true)
{
GridViewColumn Colonne1 = new GridViewColumn();
Colonne1.DisplayMemberBinding = new System.Windows.Data.Binding("Libelle");
Colonne1.Header = "Libelle";
Colonne1.Width = 247;
myGridView.Columns.Add(Colonne1);
}
#endregion
#region Prix
if (textBoxPrix.IsEnabled)
{
GridViewColumn Colonne2 = new GridViewColumn();
Colonne2.DisplayMemberBinding = new System.Windows.Data.Binding("PrixAUnite");
Colonne2.Header = "Prix";
Colonne2.Width = 60;
myGridView.Columns.Add(Colonne2);
}
#endregion
#region Main oeuvre
if (textBoxMainOeuvre.IsEnabled)
{
GridViewColumn Colonne3 = new GridViewColumn();
Colonne3.DisplayMemberBinding = new System.Windows.Data.Binding("MainOeuvreAUnite");
Colonne3.Header = "MainOeuvre";
Colonne3.Width = 90;
myGridView.Columns.Add(Colonne3);
}
#endregion
#region Quantité Mini.
if (textBoxQuantiteMini.IsEnabled)
{
GridViewColumn Colonne4 = new GridViewColumn();
Colonne4.DisplayMemberBinding = new System.Windows.Data.Binding("QuantiteMini");
Colonne4.Header = "Quantité Mini.";
Colonne4.Width = 100;
myGridView.Columns.Add(Colonne4);
}
#endregion
#region Coef Perte.
if (textBoxCoefPerte.IsEnabled)
{
GridViewColumn Colonne5 = new GridViewColumn();
Colonne5.DisplayMemberBinding = new System.Windows.Data.Binding("CoefficientPerte");
Colonne5.Header = "Cf. Perte";
Colonne5.Width = 85;
myGridView.Columns.Add(Colonne5);
}
#endregion
#region Coefficient
if (textBoxCoefficient.IsEnabled)
{
GridViewColumn Colonne6 = new GridViewColumn();
Colonne6.DisplayMemberBinding = new System.Windows.Data.Binding("Coefficient");
Colonne6.Header = "Cfficient";
Colonne6.Width = 80;
myGridView.Columns.Add(Colonne6);
}
#endregion
#region Gamme
if (comboBoxGamme.IsEnabled)
{
GridViewColumn Colonne7 = new GridViewColumn();
Colonne7.DisplayMemberBinding = new System.Windows.Data.Binding("Gamme");
Colonne7.Header = "Gamme";
Colonne7.Width = 125;
myGridView.Columns.Add(Colonne7);
}
#endregion
#region Type
if (comboBoxType.IsEnabled)
{
GridViewColumn Colonne8 = new GridViewColumn();
Colonne8.DisplayMemberBinding = new System.Windows.Data.Binding("Type");
Colonne8.Header = "Type";
Colonne8.Width = 130;
myGridView.Columns.Add(Colonne8);
}
#endregion
#region Largeur
if (textBoxLargeur.IsEnabled)
{
GridViewColumn Colonne9 = new GridViewColumn();
Colonne9.DisplayMemberBinding = new System.Windows.Data.Binding("Largeur");
Colonne9.Header = "Largeur";
Colonne9.Width = 85;
myGridView.Columns.Add(Colonne9);
}
#endregion
#region Epaisseur
if (textBoxEpaisseur.IsEnabled)
{
GridViewColumn Colonne10 = new GridViewColumn();
Colonne10.DisplayMemberBinding = new System.Windows.Data.Binding("Epaisseur");
Colonne10.Header = "Epaisseur";
Colonne10.Width = 85;
myGridView.Columns.Add(Colonne10);
}
#endregion
#region Longueur
if (textBoxLongueur.IsEnabled)
{
GridViewColumn Colonne11 = new GridViewColumn();
Colonne11.DisplayMemberBinding = new System.Windows.Data.Binding("Longueur");
Colonne11.Header = "Longueur";
Colonne11.Width = 85;
myGridView.Columns.Add(Colonne11);
}
#endregion
#region Volume
if (textBoxLargeur.IsEnabled && textBoxEpaisseur.IsEnabled && textBoxLongueur.IsEnabled)
{
GridViewColumn Colonne12 = new GridViewColumn();
Colonne12.DisplayMemberBinding = new System.Windows.Data.Binding("Volume");
Colonne12.Header = "Volume";
Colonne12.Width = 75;
myGridView.Columns.Add(Colonne12);
}
#endregion
listView1.View = myGridView;
} |
Partager