×

Notice

The forum is in read only mode.
×
Getting new Releases

To get notified on new releases you may follow us on twitter @expandframework or subscribe in our main RSS feed.

Topic-icon Lookup TileView

  • gawdenitish36
  • gawdenitish36's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
2 years 5 months ago #10361 by gawdenitish36
Lookup TileView was created by gawdenitish36
I implemented TileViewLookupListEditor.
But Object not Select in this Lookup.
i need it for Touch Environment.
please guide me. what wrong with this code.


using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Model;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Templates;
using DevExpress.ExpressApp.Utils;
using DevExpress.ExpressApp.Win.Controls;
using DevExpress.ExpressApp.Win.SystemModule;
using DevExpress.Utils.Menu;
using DevExpress.XtraBars;
using DevExpress.Xpo;
using DevExpress.XtraGrid;
using Autokit.Module.Win.CustomForm;
using DevExpress.XtraGrid.Views.Tile;

namespace Autokit.Module.Win.Editors
{
[ListEditor(typeof(PersistentBase),false)]
public class TileViewListEditor : ListEditor
{


private GridControl control;
private Object controlDataSource;
public TileViewListEditor(IModelListView info)
: base(info) {
}
public override SelectionType SelectionType
{

get { return SelectionType.Full; }

}
public override void Dispose()
{
controlDataSource = null;
base.Dispose();
}
public override IList GetSelectedObjects()
{
if (control == null)
return new object[0] { };

TileView tc = ((TileView)control.MainView);

object[] result = new object[tc.GetSelectedRows().Length];
for (int i = 0; i < tc.GetSelectedRows().Length; i++)
{
result = tc.GetRow(tc.GetSelectedRows());
}
return result;
}

public override object FocusedObject
{
get
{
return (control != null) && (((TileView)control.MainView).GetFocusedRow() != null) ? ((TileView)control.MainView).GetFocusedRow() : null;
}

}

private void control_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
OnProcessSelectedItem();
}
}
private void control_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
OnProcessSelectedItem();
}
}


public override void Refresh()
{
if (control == null)
return;
object focused = FocusedObject;
TileView tc = ((TileView)control.MainView);
tc.ClearSelection();
try
{
control.BeginUpdate();
control.DataSource = controlDataSource;


}
finally
{
control.EndUpdate();
}

FocusedObject = focused;

}

private void dataSource_ListChanged(object sender, ListChangedEventArgs e)
{
Refresh();
}

protected override void AssignDataSourceToControl(object dataSource)
{
if (dataSource is DevExpress.Xpo.XPServerCollectionSource)
{
throw new Exception("cannot use an XPServerCollectionSource object as the data source.");
}
if (controlDataSource != dataSource)
{
IBindingList oldBindable = controlDataSource as IBindingList;
if (oldBindable != null)
{
oldBindable.ListChanged -= new ListChangedEventHandler(dataSource_ListChanged);
}
controlDataSource = dataSource;
IBindingList bindable = controlDataSource as IBindingList;
if (bindable != null)
{
bindable.ListChanged += new ListChangedEventHandler(dataSource_ListChanged);
}
Refresh();
}
}

protected override object CreateControlsCore()
{
control = new EmployeePopUp().gridControl1;
TileView tc = ((TileView)control.MainView);

tc.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(Tc_SelectionChanged);
control.MouseDoubleClick += new MouseEventHandler(control_MouseDoubleClick);
control.KeyDown += new KeyEventHandler(control_KeyDown);
Refresh();
return control;
}

private void Tc_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
{
OnSelectionChanged();
OnFocusedObjectChanged();
}
}
}
More
2 years 5 months ago #10362 by Tolis
Replied by Tolis on topic Lookup TileView
first i want to ask not to post duplicates and also if posts are not eXpandFramework related to use the dedicated XAF Only forum.

Now about your quest I am afraid the editor you posted is by far incomplete and does not worth commenting at all. Implementing a XAF listEditor is not a trivial job however you can try doubling/modyfying the existing LayoutViewListEditorLayoutViewListEditor

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand
The following user(s) said Thank You: gawdenitish36
  • gawdenitish36
  • gawdenitish36's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
2 years 5 months ago - 2 years 5 months ago #10366 by gawdenitish36
Replied by gawdenitish36 on topic Lookup TileView
Sorry.......

and Thanx....

Now It is working Fine.... Thanx....
and working Screen sort.

goo.gl/photos/ar78zNUKhZFnLtEs8

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Model;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Templates;
using DevExpress.ExpressApp.Utils;
using DevExpress.ExpressApp.Win.Controls;
using DevExpress.ExpressApp.Win.SystemModule;
using DevExpress.Utils.Menu;
using DevExpress.XtraBars;
using DevExpress.Xpo;
using DevExpress.XtraGrid;
using Autokit.Module.Win.CustomForm;
using DevExpress.XtraGrid.Views.Tile;

namespace Autokit.Module.Win.Editors
{
[ListEditor(typeof(PersistentBase),false)]
public class TileViewListEditor : ListEditor
{


private GridControl control;
private Object controlDataSource;
public TileViewListEditor(IModelListView info)
: base(info) {
}
public override SelectionType SelectionType
{

get { return SelectionType.Full; }

}
public override void Dispose()
{
controlDataSource = null;
base.Dispose();
}
public override IList GetSelectedObjects()
{
if (control == null)
return new object[0] { };

TileView tc = ((TileView)control.MainView);

object[] result = new object[tc.GetSelectedRows().Length];
for (int i = 0; i < tc.GetSelectedRows().Length; i++)
{
result = tc.GetRow(tc.GetSelectedRows());
}
return result;
}

public override object FocusedObject
{
get
{
return (control != null) && (((TileView)control.MainView).GetFocusedRow() != null) ? ((TileView)control.MainView).GetFocusedRow() : null;
}
set
{
TileView tc = ((TileView)control.MainView);
if(tc.GetSelectedRows().Length > 0)
{
tc.SelectRow(tc.GetSelectedRows()[0]);
}

}

}


private void control_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
OnProcessSelectedItem();
}
}


public override void Refresh()
{
if (control == null)
return;
object focused = FocusedObject;
TileView tc = ((TileView)control.MainView);
tc.ClearSelection();
try
{
control.BeginUpdate();
control.DataSource = controlDataSource;


}
finally
{
control.EndUpdate();
}

FocusedObject = focused;

}

private void dataSource_ListChanged(object sender, ListChangedEventArgs e)
{
Refresh();
}

protected override void AssignDataSourceToControl(object dataSource)
{
if (dataSource is DevExpress.Xpo.XPServerCollectionSource)
{
throw new Exception("cannot use an XPServerCollectionSource object as the data source.");
}
if (controlDataSource != dataSource)
{
IBindingList oldBindable = controlDataSource as IBindingList;
if (oldBindable != null)
{
oldBindable.ListChanged -= new ListChangedEventHandler(dataSource_ListChanged);
}
controlDataSource = dataSource;
IBindingList bindable = controlDataSource as IBindingList;
if (bindable != null)
{
bindable.ListChanged += new ListChangedEventHandler(dataSource_ListChanged);
}
Refresh();
}
}

protected override object CreateControlsCore()
{
control = new EmployeePopUp().gridControl1; // Use external from to design Tile. and Extract GridControl Hear.
TileView tc = ((TileView)control.MainView);
tc.FocusedRowChanged += Tc_FocusedRowChanged;
tc.ItemClick += Tc_ItemClick;

control.KeyDown += new KeyEventHandler(control_KeyDown);
Refresh();
return control;
}


private void Tc_ItemClick(object sender, TileViewItemClickEventArgs e)
{
OnSelectionChanged();
OnFocusedObjectChanged();
OnProcessSelectedItem();
}

private void Tc_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
{
OnSelectionChanged();
OnFocusedObjectChanged();
}


}
}
Last edit: 2 years 5 months ago by gawdenitish36.
Moderators: expand
Time to create page: 0.209 seconds