Exemplo n.º 1
0
        public XXX()
        {
            InitializeComponent();
            //
            DataStore2 dataSource = this.createDataSource();

            {
                this.bindingSource1.DataSource = typeof(DataStore2);
                this.bindingSource1.Add(dataSource);
                //
                this.dataLayoutControl1.DataSource = bindingSource1;
                this.dataLayoutControl1.AllowGeneratingCollectionProperties = DevExpress.Utils.DefaultBoolean.True;
                this.dataLayoutControl1.RetrieveFields();
                this.dataLayoutControl1.BestFit();
                //dataLayoutControl1.AutoRetrieveFields = true;
            }
            {
                this.gridControl1.DataSource           = bindingSource1;
                this.gridControl1.UseEmbeddedNavigator = true;

                this.gridView1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Top;
                this.gridView1.OptionsView.ShowFooter         = true;
                this.gridView1.InitNewRow += new DevExpress.XtraGrid.Views.Grid.InitNewRowEventHandler(this.gridView1_InitNewRow);
                this.gridView1.OptionsBehavior.Editable = true;
                this.gridView1.OptionsBehavior.ReadOnly = false;
            }
            this.dataLayoutControl1.SaveLayoutToXml(@"D:\TEMP\SQLite\layout");
            BaseLayoutItem baseLayoutItem = this.dataLayoutControl1.Root[0];
            {
                #region Save the object
                // Create a new XmlSerializer instance with the type of the test class
                XmlSerializer SerializerObj = new XmlSerializer(typeof(DataStore2));

                // Create a new file stream to write the serialized object to a file
                TextWriter WriteFileStream = new StreamWriter(@"D:\TEMP\SQLite\DataStore2.xml");
                SerializerObj.Serialize(WriteFileStream, dataSource);

                // Cleanup
                WriteFileStream.Close();

                #endregion
            }
            BaseView mainView = this.gc.MainView;
        }
Exemplo n.º 2
0
        public DataStore2 createDataSource()
        {
            DataStore2 o = new DataStore2()
            {
                Name        = "alex",
                Description = "Alex Mello Occulate!!!",
                Props       = new List <Props>()
                {
                    new Props("prop0", "value0"),
                    new Props("prop1", "value1"),
                    new Props("prop2", "value2"),
                    new Props("prop3", "value3"),
                    new Props("prop0", "value0"),
                    new Props("prop1", "value1"),
                    new Props("prop2", "value2"),
                    new Props("prop3", "value3"),
                }
            };

            return(o);
        }