public BoundedComboBox(string Id, string label, string direct, string emptyText, string headerTitle) : base() { FieldLabel = label; EmptyText = emptyText; SimpleSubmit = true; Store store = new Ext.Net.Store(); store.ID = label + "Store"; ID = Id; IDMode = IDMode.Static; store.Proxy.Add(new PageProxy() { DirectFn = "App.direct." + direct, DirectionParam = "" }); store.IsPagingStore = true; store.PageSize = 10; MatchFieldWidth = true; Editable = false; store.AutoSync = true; DisplayField = "name"; ValueField = "recordId"; ListConfig = new BoundList(); ListConfig.Tpl = new XTemplate(); ListConfig.Tpl.Html = @"<tpl for='.'><tpl if='[xindex] == 1'><h3>" + headerTitle + "</h3><hr/></tpl><h4 class='x-boundlist-item'>{name}</h4><tpl if='[xcount-xindex]==0'><div><a href='#' target='_blank' >Add new one</a><br /></div></tpl></tpl>"; store.Model.Add(StoreFactory.GetNameValueModel()); Listeners.Expand.Handler = "#{" + store.ID + "}.reload();"; Store.Add(store); }
public static void LoadMap() { TileList.Clear(); //ObjectList.Clear(); string FullFile = File.ReadAllText(@"C:\Users\Alex\Documents\TestMap.fmf"); string[] TileData = FullFile.Substring(FullFile.IndexOf("<tile>"), FullFile.IndexOf("</tile>")).Replace("<tile>", "").Replace("</tile>", "").Split(';'); foreach (string s in TileData) { if (s != "") { string[] TileSplit = s.Split(':'); int X = Int32.Parse(TileSplit[0]); int Y = Int32.Parse(TileSplit[1]); Texture2D tx = TextureList[TileSplit[2].Replace("_", "")]; TileList.Add(new Tile(X, Y, tx)); } } int FFA = FullFile.IndexOf("<obj>"); int FFB = FullFile.IndexOf("</obj>"); string[] ObjData = FullFile.Split(new string[] { "<obj>" }, StringSplitOptions.RemoveEmptyEntries)[1].Replace("</obj>", "").Split(';'); foreach (string s in ObjData) { if (s != "") { string[] TileSplit = s.Split(':'); int X = Int32.Parse(TileSplit[0]); int Y = Int32.Parse(TileSplit[1]); Texture2D tx = ObjTextureList[TileSplit[2].Replace("_", "").Split('\\')[1]]; ObjectList.Add(new WorldObject(X, Y, tx)); } } try { string[] BndData = FullFile.Split(new string[] { "<bound>" }, StringSplitOptions.RemoveEmptyEntries)[1].Replace("</bound>", "").Split(';'); foreach (string s in BndData) { if (s != "") { string[] TileSplit = s.Split(':'); int X = Int32.Parse(TileSplit[0]); int Y = Int32.Parse(TileSplit[1]); Texture2D tx = TextureList["bound"]; BoundList.Add(new Tile(X, Y, tx)); } } } catch (Exception ex) { Debug.WriteLine(ex); } }
public ComboBoxLookup() { FieldTrigger ft = new FieldTrigger { //Icon = Ext.Net.TriggerIcon.SimpleArrowDown }; Triggers.Add(ft); ListConfig = new BoundList { LoadingText = "Searching..." }; HideTrigger = false; HideBaseTrigger = true; MinChars = 3; TypeAhead = false; ForceSelection = false; Editable = true; EmptyText = "Type something, at least 3 character..."; //this.PageSize = 10; //TriggerIcon = Ext.Net.TriggerIcon.Search; MatchFieldWidth = false; }
private void CheckBox_Checked(object sender, RoutedEventArgs e) { // update the bound list according to this event // 1: cast to checkbox and get the DataContext // 2: update the bound list using that model/DataContext var cb = sender as CheckBox; if (cb == null) { throw new ArgumentException("This only works with CheckBoxes."); } var model = cb.DataContext; if (model == null) { throw new ArgumentException("DataContext came back as null"); } if (cb.IsChecked != null && cb.IsChecked.Value) { // if is checked, add it if (!BoundList.Contains(model)) { BoundList.Add(model); } } else if (cb.IsChecked == null || !cb.IsChecked.Value) { if (BoundList.Contains(model)) { BoundList.Remove(model); } } }