Produced by Araxis Merge on 2/1/2017 2:56:49 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\ModernAndMobileApps\ModernSoapApp\Common | RichTextColumns.cs | Tue Dec 20 19:51:47 2016 UTC |
| 2 | Wed Feb 1 19:56:49 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 227 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 2 | // | |||||
| 3 | // This f ile is par t of the M icrosoft D ynamics CR M SDK Code Samples. | |||||
| 4 | // | |||||
| 5 | // Copyri ght (C) Mi crosoft Co rporation. All righ ts reserve d. | |||||
| 6 | // | |||||
| 7 | // This s ource code is intend ed only as a supplem ent to Mic rosoft | |||||
| 8 | // Develo pment Tool s and/or o nline docu mentation. See thes e other | |||||
| 9 | // materi als for de tailed inf ormation r egarding M icrosoft c ode sample s. | |||||
| 10 | // | |||||
| 11 | // THIS C ODE AND IN FORMATION ARE PROVID ED "AS IS" WITHOUT W ARRANTY OF ANY | |||||
| 12 | // KIND, EITHER EXP RESSED OR IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E | |||||
| 13 | // IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR A | |||||
| 14 | // PARTIC ULAR PURPO SE. | |||||
| 15 | // | |||||
| 16 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 17 | ||||||
| 18 | using Syst em; | |||||
| 19 | using Syst em.Collect ions.Gener ic; | |||||
| 20 | using Syst em.Linq; | |||||
| 21 | using Syst em.Threadi ng.Tasks; | |||||
| 22 | using Wind ows.Founda tion; | |||||
| 23 | using Wind ows.UI.Xam l; | |||||
| 24 | using Wind ows.UI.Xam l.Controls ; | |||||
| 25 | using Wind ows.UI.Xam l.Data; | |||||
| 26 | using Wind ows.UI.Xam l.Document s; | |||||
| 27 | ||||||
| 28 | namespace ModernSoap App.Common | |||||
| 29 | { | |||||
| 30 | /// <s ummary> | |||||
| 31 | /// Wr apper for <see cref= "RichTextB lock"/> th at creates as many a dditional overflow | |||||
| 32 | /// co lumns as n eeded to f it the ava ilable con tent. | |||||
| 33 | /// </ summary> | |||||
| 34 | /// <e xample> | |||||
| 35 | /// Th e followin g creates a collecti on of 400- pixel wide columns s paced 50 p ixels apar t | |||||
| 36 | /// to contain a rbitrary d ata-bound content: | |||||
| 37 | /// <c ode> | |||||
| 38 | /// <R ichTextCol umns> | |||||
| 39 | /// <RichTex tColumns.C olumnTempl ate> | |||||
| 40 | /// <Dat aTemplate> | |||||
| 41 | /// <RichTextB lockOverfl ow Width=" 400" Margi n="50,0,0, 0"/> | |||||
| 42 | /// </Da taTemplate > | |||||
| 43 | /// </RichTe xtColumns. ColumnTemp late> | |||||
| 44 | /// | |||||
| 45 | /// <RichTex tBlock Wid th="400"> | |||||
| 46 | /// <Par agraph> | |||||
| 47 | /// <Run Text= "{Binding Content}"/ > | |||||
| 48 | /// </Pa ragraph> | |||||
| 49 | /// </RichTe xtBlock> | |||||
| 50 | /// </ RichTextCo lumns> | |||||
| 51 | /// </ code> | |||||
| 52 | /// </ example> | |||||
| 53 | /// <r emarks>Typ ically use d in a hor izontally scrolling region whe re an unbo unded amou nt of | |||||
| 54 | /// sp ace allows for all n eeded colu mns to be created. When used in a verti cally scro lling | |||||
| 55 | /// sp ace there will never be any ad ditional c olumns.</r emarks> | |||||
| 56 | [Windo ws.UI.Xaml .Markup.Co ntentPrope rty(Name = "RichText Content")] | |||||
| 57 | public sealed cl ass RichTe xtColumns : Panel | |||||
| 58 | { | |||||
| 59 | // / <summary > | |||||
| 60 | // / Identifi es the <se e cref="Ri chTextCont ent"/> dep endency pr operty. | |||||
| 61 | // / </summar y> | |||||
| 62 | pu blic stati c readonly Dependenc yProperty RichTextCo ntentPrope rty = | |||||
| 63 | Dependen cyProperty .Register( "RichTextC ontent", t ypeof(Rich TextBlock) , | |||||
| 64 | typeof(R ichTextCol umns), new PropertyM etadata(nu ll, ResetO verflowLay out)); | |||||
| 65 | ||||||
| 66 | // / <summary > | |||||
| 67 | // / Identifi es the <se e cref="Co lumnTempla te"/> depe ndency pro perty. | |||||
| 68 | // / </summar y> | |||||
| 69 | pu blic stati c readonly Dependenc yProperty ColumnTemp lateProper ty = | |||||
| 70 | Dependen cyProperty .Register( "ColumnTem plate", ty peof(DataT emplate), | |||||
| 71 | typeof(R ichTextCol umns), new PropertyM etadata(nu ll, ResetO verflowLay out)); | |||||
| 72 | ||||||
| 73 | // / <summary > | |||||
| 74 | // / Initiali zes a new instance o f the <see cref="Ric hTextColum ns"/> clas s. | |||||
| 75 | // / </summar y> | |||||
| 76 | pu blic RichT extColumns () | |||||
| 77 | { | |||||
| 78 | this.Hor izontalAli gnment = H orizontalA lignment.L eft; | |||||
| 79 | } | |||||
| 80 | ||||||
| 81 | // / <summary > | |||||
| 82 | // / Gets or sets the i nitial ric h text con tent to be used as t he first c olumn. | |||||
| 83 | // / </summar y> | |||||
| 84 | pu blic RichT extBlock R ichTextCon tent | |||||
| 85 | { | |||||
| 86 | get { re turn (Rich TextBlock) GetValue(R ichTextCon tentProper ty); } | |||||
| 87 | set { Se tValue(Ric hTextConte ntProperty , value); } | |||||
| 88 | } | |||||
| 89 | ||||||
| 90 | // / <summary > | |||||
| 91 | // / Gets or sets the t emplate us ed to crea te additio nal | |||||
| 92 | // / <see cre f="RichTex tBlockOver flow"/> in stances. | |||||
| 93 | // / </summar y> | |||||
| 94 | pu blic DataT emplate Co lumnTempla te | |||||
| 95 | { | |||||
| 96 | get { re turn (Data Template)G etValue(Co lumnTempla teProperty ); } | |||||
| 97 | set { Se tValue(Col umnTemplat eProperty, value); } | |||||
| 98 | } | |||||
| 99 | ||||||
| 100 | // / <summary > | |||||
| 101 | // / Invoked when the c ontent or overflow t emplate is changed t o recreate the colum n layout. | |||||
| 102 | // / </summar y> | |||||
| 103 | // / <param n ame="d">In stance of <see cref= "RichTextC olumns"/> where the change | |||||
| 104 | // / occurred .</param> | |||||
| 105 | // / <param n ame="e">Ev ent data d escribing the specif ic change. </param> | |||||
| 106 | pr ivate stat ic void Re setOverflo wLayout(De pendencyOb ject d, De pendencyPr opertyChan gedEventAr gs e) | |||||
| 107 | { | |||||
| 108 | // When dramatic c hanges occ ur, rebuil d the colu mn layout from scrat ch | |||||
| 109 | var targ et = d as RichTextCo lumns; | |||||
| 110 | if (targ et != null ) | |||||
| 111 | { | |||||
| 112 | targ et._overfl owColumns = null; | |||||
| 113 | targ et.Childre n.Clear(); | |||||
| 114 | targ et.Invalid ateMeasure (); | |||||
| 115 | } | |||||
| 116 | } | |||||
| 117 | ||||||
| 118 | // / <summary > | |||||
| 119 | // / Lists ov erflow col umns alrea dy created . Must ma intain a 1 :1 relatio nship with | |||||
| 120 | // / instance s in the < see cref=" Panel.Chil dren"/> co llection f ollowing t he initial | |||||
| 121 | // / RichText Block chil d. | |||||
| 122 | // / </summar y> | |||||
| 123 | pr ivate List <RichTextB lockOverfl ow> _overf lowColumns = null; | |||||
| 124 | ||||||
| 125 | // / <summary > | |||||
| 126 | // / Determin es whether additiona l overflow columns a re needed and if exi sting colu mns can | |||||
| 127 | // / be remov ed. | |||||
| 128 | // / </summar y> | |||||
| 129 | // / <param n ame="avail ableSize"> The size o f the spac e availabl e, used to constrain the | |||||
| 130 | // / number o f addition al columns that can be created .</param> | |||||
| 131 | // / <returns >The resul ting size of the ori ginal cont ent plus a ny extra c olumns.</r eturns> | |||||
| 132 | pr otected ov erride Siz e MeasureO verride(Si ze availab leSize) | |||||
| 133 | { | |||||
| 134 | if (this .RichTextC ontent == null) retu rn new Siz e(0, 0); | |||||
| 135 | ||||||
| 136 | // Make sure the R ichTextBlo ck is a ch ild, using the lack of | |||||
| 137 | // a lis t of addit ional colu mns as a s ign that t his hasn't been | |||||
| 138 | // done yet | |||||
| 139 | if (this ._overflow Columns == null) | |||||
| 140 | { | |||||
| 141 | Chil dren.Add(t his.RichTe xtContent) ; | |||||
| 142 | this ._overflow Columns = new List<R ichTextBlo ckOverflow >(); | |||||
| 143 | } | |||||
| 144 | ||||||
| 145 | // Start by measur ing the or iginal Ric hTextBlock content | |||||
| 146 | this.Ric hTextConte nt.Measure (available Size); | |||||
| 147 | var maxW idth = thi s.RichText Content.De siredSize. Width; | |||||
| 148 | var maxH eight = th is.RichTex tContent.D esiredSize .Height; | |||||
| 149 | var hasO verflow = this.RichT extContent .HasOverfl owContent; | |||||
| 150 | ||||||
| 151 | // Make sure there are enoug h overflow columns | |||||
| 152 | int over flowIndex = 0; | |||||
| 153 | while (h asOverflow && maxWid th < avail ableSize.W idth && th is.ColumnT emplate != null) | |||||
| 154 | { | |||||
| 155 | // U se existin g overflow columns u ntil we ru n out, the n create | |||||
| 156 | // m ore from t he supplie d template | |||||
| 157 | Rich TextBlockO verflow ov erflow; | |||||
| 158 | if ( this._over flowColumn s.Count > overflowIn dex) | |||||
| 159 | { | |||||
| 160 | overflow = this._ove rflowColum ns[overflo wIndex]; | |||||
| 161 | } | |||||
| 162 | else | |||||
| 163 | { | |||||
| 164 | overflow = (RichText BlockOverf low)this.C olumnTempl ate.LoadCo ntent(); | |||||
| 165 | this._over flowColumn s.Add(over flow); | |||||
| 166 | this.Child ren.Add(ov erflow); | |||||
| 167 | if (overfl owIndex == 0) | |||||
| 168 | { | |||||
| 169 | this.R ichTextCon tent.Overf lowContent Target = o verflow; | |||||
| 170 | } | |||||
| 171 | else | |||||
| 172 | { | |||||
| 173 | this._ overflowCo lumns[over flowIndex - 1].Overf lowContent Target = o verflow; | |||||
| 174 | } | |||||
| 175 | } | |||||
| 176 | ||||||
| 177 | // M easure the new colum n and prep are to rep eat as nec essary | |||||
| 178 | over flow.Measu re(new Siz e(availabl eSize.Widt h - maxWid th, availa bleSize.He ight)); | |||||
| 179 | maxW idth += ov erflow.Des iredSize.W idth; | |||||
| 180 | maxH eight = Ma th.Max(max Height, ov erflow.Des iredSize.H eight); | |||||
| 181 | hasO verflow = overflow.H asOverflow Content; | |||||
| 182 | over flowIndex+ +; | |||||
| 183 | } | |||||
| 184 | ||||||
| 185 | // Disco nnect extr a columns from the o verflow ch ain, remov e them fro m our priv ate list | |||||
| 186 | // of co lumns, and remove th em as chil dren | |||||
| 187 | if (this ._overflow Columns.Co unt > over flowIndex) | |||||
| 188 | { | |||||
| 189 | if ( overflowIn dex == 0) | |||||
| 190 | { | |||||
| 191 | this.RichT extContent .OverflowC ontentTarg et = null; | |||||
| 192 | } | |||||
| 193 | else | |||||
| 194 | { | |||||
| 195 | this._over flowColumn s[overflow Index - 1] .OverflowC ontentTarg et = null; | |||||
| 196 | } | |||||
| 197 | whil e (this._o verflowCol umns.Count > overflo wIndex) | |||||
| 198 | { | |||||
| 199 | this._over flowColumn s.RemoveAt (overflowI ndex); | |||||
| 200 | this.Child ren.Remove At(overflo wIndex + 1 ); | |||||
| 201 | } | |||||
| 202 | } | |||||
| 203 | ||||||
| 204 | // Repor t final de termined s ize | |||||
| 205 | return n ew Size(ma xWidth, ma xHeight); | |||||
| 206 | } | |||||
| 207 | ||||||
| 208 | // / <summary > | |||||
| 209 | // / Arranges the origi nal conten t and all extra colu mns. | |||||
| 210 | // / </summar y> | |||||
| 211 | // / <param n ame="final Size">Defi nes the si ze of the area the c hildren mu st be arra nged | |||||
| 212 | // / within.< /param> | |||||
| 213 | // / <returns >The size of the are a the chil dren actua lly requir ed.</retur ns> | |||||
| 214 | pr otected ov erride Siz e ArrangeO verride(Si ze finalSi ze) | |||||
| 215 | { | |||||
| 216 | double m axWidth = 0; | |||||
| 217 | double m axHeight = 0; | |||||
| 218 | foreach (var child in Childr en) | |||||
| 219 | { | |||||
| 220 | chil d.Arrange( new Rect(m axWidth, 0 , child.De siredSize. Width, fin alSize.Hei ght)); | |||||
| 221 | maxW idth += ch ild.Desire dSize.Widt h; | |||||
| 222 | maxH eight = Ma th.Max(max Height, ch ild.Desire dSize.Heig ht); | |||||
| 223 | } | |||||
| 224 | return n ew Size(ma xWidth, ma xHeight); | |||||
| 225 | } | |||||
| 226 | } | |||||
| 227 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.