70 likes | 188 Vues
This guide covers essential concepts in UI element sizing, positioning, and transforming. Key aspects include setting minimum and maximum heights and widths, alongside understanding read-only properties like DesiredSize and RenderSize. The concept of device-independent pixels (DIPs) and how size translates across different DPI settings is clarified. Additionally, this resource explains control positioning through alignment properties, as well as applying various transforms—LayoutTransform and RenderTransform—using Rotate, Scale, Skew, Translate, and Matrix transforms, noting the limitations in transform support among FrameworkElements.
E N D
Height and Width • MinHeight, MaxHeight, MinWidth, MaxWidth • DesiredSize(read-only) • Calculated during layout • RenderSize(read-only) • Final size of an element after layout is complete • ActualHeight, ActualWidth(read-only) • Equal to RenderSize.Height and RenderSize.Width
DIP • Device-Independent Pixels • 1/96 inch, regardless of the screen’s DPI setting • 96 • On a typical 96-DPI display, 1 dip = 1 physical pixel
Control Position • Alignment • HorizontalAlignment • VerticalAlignment • Content Alignment • FlowDirection (explicitly set to match the current culture)
Applying Transforms • LayoutTransform (before the element is laid out) • RenderTransform (after the layout process has finished) • RotateTransform • ScaleTransform • SkewTransform • TranslateTransform • MatrixTransform • Not all FrameworkElementssupport transforms!