示例#1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.singleViewContainer = ((ViewNoteWindow.SingleViewTag)(target));
                return;

            case 2:
                this.singleViewTag = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.lbTitle = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.lbxTags = ((System.Windows.Controls.ListBox)(target));

            #line 20 "..\..\..\views\SingleViewTag.xaml"
                this.lbxTags.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbxTags_SelectionChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
示例#2
0
        public void createGridParent()
        {
            childList = new Dictionary <string, List <TAG> >();
            List <TAG> listTag = obs.getAllTAG();

            listTag.Sort(delegate(TAG t1, TAG t2)
            {
                return(t1.mContent.CompareTo(t2.mContent));
            });

            foreach (TAG tag in listTag)
            {
                string firstChar = tag.mContent[0].ToString();
                if (!childList.ContainsKey(firstChar))
                {
                    childList.Add(firstChar, new List <TAG>());
                }
                childList[firstChar].Add(tag);
            }

            int gridHeight = (int)gridMain.Height;

            StackPanel sp = new StackPanel();

            sp.Height            = gridHeight;
            sp.Width             = widthOfSingleTag;
            sp.Orientation       = Orientation.Vertical;
            sp.VerticalAlignment = VerticalAlignment.Top;

            foreach (var entry in childList)
            {
                int numOfTags = entry.Value.Count;
                if (gridHeight - (numOfTags * heightPerTag + heightLabel) > 150)
                {
                    gridHeight -= (numOfTags * heightPerTag + heightLabel + preventiveHeight);
                    SingleViewTag curSingleViewTag = new SingleViewTag(this, entry, heightPerTag, heightLabel);

                    sp.Children.Add(curSingleViewTag);
                }
                else
                {
                    gridHeight = (int)gridMain.Height - (numOfTags * heightPerTag + heightLabel);
                    stackParent.Children.Add(sp);
                    sp                   = new StackPanel();
                    sp.Height            = gridHeight;
                    sp.Width             = widthOfSingleTag;
                    sp.VerticalAlignment = VerticalAlignment.Top;
                    var curSingleViewTag = new SingleViewTag(this, entry, heightPerTag, heightLabel);

                    sp.Children.Add(curSingleViewTag);
                }
            }
            stackParent.Children.Add(sp);
        }