DataGrid Width在Windows Mobile Psion Omnii Xt15中没有任何影响

时间:2013-07-17 22:42:41

标签: c# windows mobile

这是我用来设置列样式的代码...但它只适用于Windows CE5,但是当我在最新的Mobile Psion Omnii Xt15上使用它时,宽度会被忽略,只显示大约20像素每列,都被压扁了。

这是我用来绑定网格的DataTable ..

    /// <summary>
    ///Represents the strongly named DataTable class.
    ///</summary>
    [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
    public partial class ContainersDataTable : global::System.Data.DataTable, global::System.Collections.IEnumerable {

        private global::System.Data.DataColumn columnContainer_ID;

        private global::System.Data.DataColumn columnScanValue;

        private global::System.Data.DataColumn columnLkContainerType_ID;

        private global::System.Data.DataColumn columnParentContainer_ID;

        private global::System.Data.DataColumn columnQuantity;

        private global::System.Data.DataColumn columnContainerType_Text;

        private global::System.Data.DataColumn columnScanValueDisplay;

        private global::System.Data.DataColumn columnGenComment;

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public ContainersDataTable() {
            this.TableName = "Containers";
            this.BeginInit();
            this.InitClass();
            this.EndInit();
        }

这是我用来设置列样式的代码......

 private void InitializeContainerGrid()
    {
        DataGridTableStyle ts = new DataGridTableStyle {MappingName = "Containers"};

        // container type 
        DataGridColumnStyle unitCol = new DataGridTextBoxColumn
                                          {
                                              MappingName = ContainerType_Text,
                                              HeaderText = "Unit",
                                              Width = 50
                                          };
        ts.GridColumnStyles.Add(unitCol);

        // scan value
        DataGridColumnStyle scanValueCol = new DataGridTextBoxColumn
                                               {
                                                   MappingName = "ScanValueDisplay",
                                                   HeaderText = "Scan Value",
                                                   Width = 110
                                               };
        ts.GridColumnStyles.Add(scanValueCol);

        // number of fruit
        DataGridColumnStyle fruitNoCol = new DataGridTextBoxColumn
                                             {
                                                 MappingName = Quantity,
                                                 HeaderText = "Fruit",
                                                 Width = 50
                                             };
        ts.GridColumnStyles.Add(fruitNoCol);

        containerGrid.TableStyles.Add(ts);
    }

1 个答案:

答案 0 :(得分:0)

原来Psion上的分辨率是其他设备的两倍......所以虽然它看起来没有设置宽度,但它实际上是......只是因为分辨率加倍所以我想到的是什么。