basically want lay out visual elements can change content according location laid. want in wpf might able suggest general algorithm without knowing wpf.
example: consider wrappanel contains labels hold text. when label laid wrappanel @ beginning of new row leading white spaces removed text. indeed make label shorter.
the think knows such label laid wrapppanel layouting. 1 approach code custom panel overrides measureoverride , arrangeoverride , change labels inside measureoverride before calling measure on label. don't because:
- it ugly hack (
panel,measureoverride,arrangeoverideshould position children not change them). - i'm not sure think if changed
labelinsidemeasureoverridelabelcause layout updated in response lead (recursive) callmeasureoverride(=> infinite loop).
so please suggest right design scenario. how should this? 1 comes mind to:
- have regular
wrappanel. - every times
widthorheightchanged or children changed (its children might repositioned) update children beforemeasureoverride,arrangeoverridecalled. - during process of updating children (2.) no call
measureorarrangeofwrappanelcan made. question: how temporally inhibit such calls ?
before suggest use richtextbox or textblock deal white space @ beginning of lines note labels , white spaces example - little more complicated. if know how solve 'labels , white spaces' correctly i'll know how solve real problem too.
if want know why need have on question create guitar chords editor in wpf , h.b.'s answer.
Comments
Post a Comment