@@ -106,6 +106,8 @@ to select which `IconPack` and `Kind` of icon to draw. You can change the size
106106and color with respectively ` Size ` and ` Foreground ` properties. It uses a
107107default icon size and a white color, which should be good enough in most cases.
108108
109+ ** UI scaling:**
110+
109111** DO** use ` WolvenKitFont... ` , ` WolvenKitIcon... ` , ` WolvenKitMargin... ` and
110112other dynamic resources to draw a responsive UI. You can find plenty of them in
111113codebase, for example:
@@ -123,9 +125,93 @@ When the user changes UI scaling, the logic in `WolvenKit.App/ViewModels/Shell/A
123125is called to update these values.
124126
125127** DO** update, add or remove dynamic entries properly:
126- * Follow the current naming convention, it helps keeping things organized in
127- the IDE's autocomplete
128- * Update ` AppViewModel:UpdateScaleResources() ` method for the updated, added or removed entries
128+ - update ` AppViewModel:UpdateScaleResources() ` method for the updated, added
129+ or removed entries
130+ - follow the current naming convention, it helps keeping things organized in
131+ the IDE's autocomplete
132+
133+ ** Responsiveness:**
134+
135+ Currently, this application poorly implements responsive UI. It is expected for
136+ users to run this application with at least a 1080p screen resolution, with a
137+ maximized window.
138+
139+ However, anyone is free to write PRs in order to add responsive UI where
140+ needed.
141+
142+ > [ !NOTE]
143+ > Responsiveness is in addition to scaling the UI, like mentioned above. We are
144+ > mostly focusing on the layout of UI elements when refering to responsive UI.
145+
146+ ` WelcomePageView ` is the first view implementing a responsive UI (see [ #2628 ] ).
147+ For now, the principal solution is to use XAML only with converters to shape
148+ the layout of a view, based on breakpoint widths of the window:
149+ - a breakpoint width is a threshold of the current size of the window (in
150+ pixels).
151+ - a converter is a condition (like ` LessThanConverter ` ) which change states of
152+ a UI element when a breakpoint is triggered or not.
153+
154+ Any ` Style ` defined for a responsive UI should be suffixed with
155+ ` ResponsiveStyle ` . For example ` CardResponsiveStyle ` . This help quickly
156+ identify what is the purpose of this style.
157+
158+ You can define a ` Style ` with a ` Trigger ` and change properties, like
159+ ` Grid.Row ` for example. In this case, you will need to define the default value
160+ of the property in the style, and the new value in the trigger declaration.
161+ Moreover, the property ` Grid.Row ` (for example) must be removed of its element.
162+ This is required because any property on a UI element always takes precedence.
163+ See this example:
164+
165+ ``` xaml
166+ <!-- Inside a ResourceDictionary -->
167+ <converters : LessThanConverter x : Key =" LessThanConverter" />
168+
169+ <Style
170+ x:Key=" ExampleResponsiveStyle"
171+ TargetType=" {x:Type Grid}" >
172+ <!-- Default value required -->
173+ <Setter Property =" Grid.Row" Value =" 0" />
174+
175+ <Style .Triggers>
176+ <!-- Trigger when ActualWidth < WolvenKitWelcomeBreakWidth -->
177+ <DataTrigger
178+ Binding=" {Binding Path=ActualWidth,
179+ Converter={StaticResource LessThanConverter},
180+ ConverterParameter=WolvenKitWelcomeBreakWidth,
181+ RelativeSource={RelativeSource AncestorType=Window}}"
182+ Value=" True" >
183+
184+ <Setter Property =" Grid.Row" Value =" 1" />
185+ </DataTrigger >
186+ </Style .Triggers>
187+ </Style >
188+
189+ <!-- After ResourceDictionary -->
190+
191+ <Grid >
192+ <Grid .RowDefinitions>
193+ <RowDefinition />
194+ <!-- 2nd row reserved for responsiveness -->
195+ <RowDefinition />
196+ </Grid .RowDefinitions>
197+
198+ <TextBlock x : Key =" {StaticResource ExampleResponsiveStyle}" />
199+ </Grid >
200+ ```
201+
202+ A few notes about this snippet of code:
203+ - ` ConverterParameter ` must be a ` string ` of a dynamic resource. This allows
204+ UI scaling too.
205+ - ` <!-- 2nd row reserved for responsiveness --> ` or similar comment should be
206+ used to clearly inform users the UI element is indeed used and must not be
207+ removed without a good reason.
208+
209+ > [ !NOTE]
210+ > In some cases, we cannot explicitly define ` Grid.Row ` nor ` Grid.Column ` when
211+ > they must be changed for responsiveness. This is an exception to the rule
212+ > defined above (WPF / XAML being the culprit here).
213+
214+ [ #2628 ] : https://github.com/WolvenKit/WolvenKit/pull/2628
129215
130216### Code Style
131217
0 commit comments