88 xmlns:utu=" using:Uno.Toolkit.UI"
99 mc:Ignorable=" skia" >
1010
11+ <Style TargetType =" uer:FeedView"
12+ BasedOn =" {StaticResource DefaultFeedViewStyle}" />
1113
12- </ResourceDictionary >
14+
15+ <Style TargetType =" uer:FeedView"
16+ x : Key =" DefaultFeedViewStyle" >
17+ <Setter Property =" VerticalAlignment" Value =" Stretch" />
18+ <Setter Property =" HorizontalAlignment" Value =" Stretch" />
19+ <Setter Property =" VerticalContentAlignment" Value =" Stretch" />
20+ <Setter Property =" HorizontalContentAlignment" Value =" Stretch" />
21+ <Setter Property =" ProgressTemplate" >
22+ <Setter .Value>
23+ <DataTemplate >
24+ <Grid >
25+ <ProgressRing IsActive =" {Binding}"
26+ Width =" 50"
27+ Height =" 50"
28+ VerticalAlignment =" Center"
29+ HorizontalAlignment =" Center" />
30+ </Grid >
31+ </DataTemplate >
32+ </Setter .Value>
33+ </Setter >
34+ <Setter Property =" ErrorTemplate" >
35+ <Setter .Value>
36+ <DataTemplate >
37+ <Grid >
38+ <TextBlock Text =" An error occurred."
39+ VerticalAlignment =" Center"
40+ HorizontalAlignment =" Center" />
41+ </Grid >
42+ </DataTemplate >
43+ </Setter .Value>
44+ </Setter >
45+ <Setter Property =" Template" >
46+ <Setter .Value>
47+ <ControlTemplate TargetType =" uer:FeedView" >
48+ <Grid VerticalAlignment =" {TemplateBinding VerticalContentAlignment}"
49+ HorizontalAlignment =" {TemplateBinding HorizontalContentAlignment}" >
50+ <VisualStateManager .CustomVisualStateManager>
51+ <uer : SmoothVisualStateManager >
52+ <uer : SmoothVisualStateRule MinDuration =" 0:0:0.500" />
53+ <uer : SmoothVisualStateRule Group =" ProgressGroup"
54+ To =" Indeterminate"
55+ Delay =" 0:0:0.250" />
56+ </uer : SmoothVisualStateManager >
57+ </VisualStateManager .CustomVisualStateManager>
58+ <VisualStateManager .VisualStateGroups>
59+ <VisualStateGroup x : Name =" DataGroup" >
60+ <VisualState x : Name =" Undefined" />
61+ <VisualState x : Name =" None" >
62+ <VisualState .Setters>
63+ <Setter Target =" UndefinedPresenter.Visibility" Value =" Collapsed" />
64+ <Setter Target =" NonePresenter.Visibility" Value =" Visible" />
65+ <Setter Target =" SomePresenter.Visibility" Value =" Collapsed" />
66+ </VisualState .Setters>
67+ </VisualState >
68+ <VisualState x : Name =" Some" >
69+ <VisualState .Setters>
70+ <Setter Target =" UndefinedPresenter.Visibility" Value =" Collapsed" />
71+ <Setter Target =" NonePresenter.Visibility" Value =" Collapsed" />
72+ <Setter Target =" SomePresenter.Visibility" Value =" Visible" />
73+ </VisualState .Setters>
74+ </VisualState >
75+ </VisualStateGroup >
76+ <VisualStateGroup x : Name =" ErrorGroup" >
77+ <VisualState x : Name =" NoError" />
78+ <VisualState x : Name =" Error" >
79+ <VisualState .Setters>
80+ <Setter Target =" DataRoot.Visibility" Value =" Collapsed" />
81+ <Setter Target =" ErrorRoot.Visibility" Value =" Visible" />
82+ </VisualState .Setters>
83+ </VisualState >
84+ </VisualStateGroup >
85+ <VisualStateGroup x : Name =" ProgressGroup" >
86+ <VisualStateGroup .Transitions>
87+ <VisualTransition To =" Indeterminate" >
88+ <Storyboard >
89+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName=" ProgressRoot"
90+ Storyboard.TargetProperty=" Visibility" >
91+ <DiscreteObjectKeyFrame KeyTime =" 0:0:0"
92+ Value=" Visible" />
93+ </ObjectAnimationUsingKeyFrames >
94+ <DoubleAnimation Storyboard.TargetName=" ProgressPresenter"
95+ Storyboard.TargetProperty=" Opacity"
96+ From =" 0"
97+ To =" 1"
98+ Duration =" 0:0:0.100" />
99+ <DoubleAnimation Storyboard.TargetName=" DataRoot"
100+ Storyboard.TargetProperty=" Opacity"
101+ To =" 0"
102+ Duration =" 0:0:0.100" />
103+ <DoubleAnimation Storyboard.TargetName=" ErrorRoot"
104+ Storyboard.TargetProperty=" Opacity"
105+ To =" 0"
106+ Duration =" 0:0:0.100" />
107+ </Storyboard >
108+ </VisualTransition >
109+ <VisualTransition From =" Indeterminate" >
110+ <Storyboard >
111+ <DoubleAnimation Storyboard.TargetName=" ProgressPresenter"
112+ Storyboard.TargetProperty=" Opacity"
113+ From =" 1"
114+ To =" 0"
115+ Duration =" 0:0:0.100" />
116+ </Storyboard >
117+ </VisualTransition >
118+ </VisualStateGroup .Transitions>
119+ <VisualState x : Name =" NoProgress" />
120+ <VisualState x : Name =" Indeterminate" >
121+ <VisualState .Setters>
122+ <Setter Target =" DataRoot.Visibility" Value =" Collapsed" />
123+ <Setter Target =" ErrorRoot.Visibility" Value =" Collapsed" />
124+ <Setter Target =" ProgressRoot.Visibility" Value =" Visible" />
125+ </VisualState .Setters>
126+ </VisualState >
127+ </VisualStateGroup >
128+ </VisualStateManager .VisualStateGroups>
129+
130+ <Grid x : Name =" DataRoot" >
131+ <ContentPresenter x : Name =" UndefinedPresenter"
132+ Content =" {TemplateBinding Undefined}"
133+ ContentTemplate =" {TemplateBinding UndefinedTemplate}"
134+ VerticalAlignment =" Stretch"
135+ HorizontalAlignment =" Stretch"
136+ VerticalContentAlignment =" Stretch"
137+ HorizontalContentAlignment =" Stretch"
138+ Visibility =" Visible" />
139+ <ContentPresenter x : Name =" NonePresenter"
140+ Content =" {TemplateBinding None}"
141+ ContentTemplate =" {TemplateBinding NoneTemplate}"
142+ VerticalAlignment =" Stretch"
143+ HorizontalAlignment =" Stretch"
144+ VerticalContentAlignment =" Stretch"
145+ HorizontalContentAlignment =" Stretch"
146+ Visibility =" Collapsed" />
147+ <ContentPresenter x : Name =" SomePresenter"
148+ Content =" {TemplateBinding State}"
149+ ContentTemplate =" {TemplateBinding ValueTemplate}"
150+ VerticalAlignment =" Stretch"
151+ HorizontalAlignment =" Stretch"
152+ VerticalContentAlignment =" Stretch"
153+ HorizontalContentAlignment =" Stretch"
154+ Visibility =" Collapsed" />
155+ </Grid >
156+
157+ <Grid x : Name =" ErrorRoot"
158+ Visibility =" Collapsed" >
159+ <ContentPresenter x : Name =" ErrorPresenter"
160+ Content =" {Binding RelativeSource={RelativeSource TemplatedParent}, Path=State.Error}"
161+ ContentTemplate =" {TemplateBinding ErrorTemplate}"
162+ HorizontalAlignment =" Stretch"
163+ VerticalAlignment =" Stretch"
164+ VerticalContentAlignment =" Stretch"
165+ HorizontalContentAlignment =" Stretch" />
166+ </Grid >
167+
168+ <Grid x : Name =" ProgressRoot"
169+ Visibility =" Collapsed" >
170+ <ContentPresenter x : Name =" ProgressPresenter"
171+ Content =" {Binding RelativeSource={RelativeSource TemplatedParent}, Path=State.Progress}"
172+ ContentTemplate =" {TemplateBinding ProgressTemplate}"
173+ HorizontalAlignment =" Stretch"
174+ VerticalAlignment =" Stretch"
175+ VerticalContentAlignment =" Stretch"
176+ HorizontalContentAlignment =" Stretch" />
177+ </Grid >
178+ </Grid >
179+ </ControlTemplate >
180+ </Setter .Value>
181+ </Setter >
182+ </Style >
183+
184+ <!--
185+ We need to redefine this as packages cannot ship multiple styles at once by default.
186+ We need to take a similar approach to what we did for material to pack multiple styles.
187+ -->
188+ <Style TargetType =" uer:FeedView"
189+ x : Key =" CompositeFeedViewStyle" >
190+ <Setter Property =" VerticalAlignment" Value =" Stretch" />
191+ <Setter Property =" HorizontalAlignment" Value =" Stretch" />
192+ <Setter Property =" VerticalContentAlignment" Value =" Stretch" />
193+ <Setter Property =" HorizontalContentAlignment" Value =" Stretch" />
194+ <Setter Property =" ProgressTemplate" >
195+ <Setter .Value>
196+ <DataTemplate >
197+ <Grid Background =" #33FFFFFF"
198+ Width =" 75"
199+ Height =" 75"
200+ HorizontalAlignment =" Center"
201+ VerticalAlignment =" Center" >
202+ <ProgressRing IsActive =" {Binding}"
203+ Width =" 50"
204+ Height =" 50"
205+ VerticalAlignment =" Center"
206+ HorizontalAlignment =" Center" />
207+ </Grid >
208+ </DataTemplate >
209+ </Setter .Value>
210+ </Setter >
211+ <Setter Property =" ErrorTemplate" >
212+ <Setter .Value>
213+ <DataTemplate >
214+ <Grid Background =" Red" >
215+ <TextBlock Text =" An error occurred."
216+ VerticalAlignment =" Center"
217+ HorizontalAlignment =" Center" />
218+ </Grid >
219+ </DataTemplate >
220+ </Setter .Value>
221+ </Setter >
222+ <Setter Property =" Template" >
223+ <Setter .Value>
224+ <ControlTemplate TargetType =" uer:FeedView" >
225+ <Grid VerticalAlignment =" {TemplateBinding VerticalContentAlignment}"
226+ HorizontalAlignment =" {TemplateBinding HorizontalContentAlignment}" >
227+ <VisualStateManager .CustomVisualStateManager>
228+ <uer : SmoothVisualStateManager >
229+ <uer : SmoothVisualStateRule MinDuration =" 0:0:0.500" />
230+ <uer : SmoothVisualStateRule Group =" ProgressGroup"
231+ To =" Indeterminate"
232+ Delay =" 0:0:0.250" />
233+ </uer : SmoothVisualStateManager >
234+ </VisualStateManager .CustomVisualStateManager>
235+ <VisualStateManager .VisualStateGroups>
236+ <VisualStateGroup x : Name =" DataGroup" >
237+ <VisualState x : Name =" Undefined" />
238+ <VisualState x : Name =" None" >
239+ <VisualState .Setters>
240+ <Setter Target =" UndefinedPresenter.Visibility" Value =" Collapsed" />
241+ <Setter Target =" NonePresenter.Visibility" Value =" Visible" />
242+ <Setter Target =" SomePresenter.Visibility" Value =" Collapsed" />
243+ </VisualState .Setters>
244+ </VisualState >
245+ <VisualState x : Name =" Some" >
246+ <VisualState .Setters>
247+ <Setter Target =" UndefinedPresenter.Visibility" Value =" Collapsed" />
248+ <Setter Target =" NonePresenter.Visibility" Value =" Collapsed" />
249+ <Setter Target =" SomePresenter.Visibility" Value =" Visible" />
250+ </VisualState .Setters>
251+ </VisualState >
252+ </VisualStateGroup >
253+ <VisualStateGroup x : Name =" ErrorGroup" >
254+ <VisualStateGroup .Transitions>
255+ <VisualTransition To =" Error" >
256+ <Storyboard >
257+ <ObjectAnimationUsingKeyFrames Storyboard.TargetName=" ErrorRoot"
258+ Storyboard.TargetProperty=" Visibility" >
259+ <DiscreteObjectKeyFrame KeyTime =" 0:0:0"
260+ Value=" Visible" />
261+ </ObjectAnimationUsingKeyFrames >
262+ <DoubleAnimation Storyboard.TargetName=" ErrorPresenterTransform"
263+ Storyboard.TargetProperty=" Y"
264+ From =" -10"
265+ To =" 0"
266+ Duration =" 0:0:.5" />
267+ <DoubleAnimation Storyboard.TargetName=" ErrorRoot"
268+ Storyboard.TargetProperty=" Opacity"
269+ From =" 0"
270+ To =" 1"
271+ Duration =" 0:0:.5" />
272+ </Storyboard >
273+ </VisualTransition >
274+ </VisualStateGroup .Transitions>
275+ <VisualState x : Name =" NoError" />
276+ <VisualState x : Name =" Error" >
277+ <VisualState .Setters>
278+ <Setter Target =" ErrorRoot.Visibility" Value =" Visible" />
279+ </VisualState .Setters>
280+ <Storyboard >
281+ <DoubleAnimation Storyboard.TargetName=" ErrorRoot"
282+ Storyboard.TargetProperty=" Opacity"
283+ To =" 0"
284+ Duration =" 0:0:1"
285+ BeginTime =" 0:0:10" />
286+ </Storyboard >
287+ </VisualState >
288+ </VisualStateGroup >
289+ <VisualStateGroup x : Name =" ProgressGroup" >
290+ <VisualState x : Name =" NoProgress" />
291+ <VisualState x : Name =" Indeterminate" >
292+ <VisualState .Setters>
293+ <Setter Target =" ProgressPresenter.Visibility" Value =" Visible" />
294+ </VisualState .Setters>
295+ </VisualState >
296+ </VisualStateGroup >
297+ </VisualStateManager .VisualStateGroups>
298+
299+ <ContentPresenter x : Name =" UndefinedPresenter"
300+ Content =" {TemplateBinding Undefined}"
301+ ContentTemplate =" {TemplateBinding UndefinedTemplate}"
302+ VerticalAlignment =" Stretch"
303+ HorizontalAlignment =" Stretch"
304+ VerticalContentAlignment =" Stretch"
305+ HorizontalContentAlignment =" Stretch"
306+ Visibility =" Visible" />
307+ <ContentPresenter x : Name =" NonePresenter"
308+ Content =" {TemplateBinding None}"
309+ ContentTemplate =" {TemplateBinding NoneTemplate}"
310+ VerticalAlignment =" Stretch"
311+ HorizontalAlignment =" Stretch"
312+ VerticalContentAlignment =" Stretch"
313+ HorizontalContentAlignment =" Stretch"
314+ Visibility =" Collapsed" />
315+ <ContentPresenter x : Name =" SomePresenter"
316+ Content =" {TemplateBinding State}"
317+ ContentTemplate =" {TemplateBinding ValueTemplate}"
318+ VerticalAlignment =" Stretch"
319+ HorizontalAlignment =" Stretch"
320+ VerticalContentAlignment =" Stretch"
321+ HorizontalContentAlignment =" Stretch"
322+ Visibility =" Collapsed" />
323+
324+ <Border x : Name =" ErrorRoot"
325+ HorizontalAlignment=" Center"
326+ VerticalAlignment=" Top"
327+ Visibility=" Collapsed"
328+ Padding=" 20" >
329+ <Border .RenderTransform>
330+ <TranslateTransform x : Name =" ErrorPresenterTransform" />
331+ </Border .RenderTransform>
332+ <ContentPresenter Content =" {Binding RelativeSource={RelativeSource TemplatedParent}, Path=State.Error}"
333+ ContentTemplate =" {TemplateBinding ErrorTemplate}"
334+ HorizontalAlignment =" Stretch"
335+ VerticalAlignment =" Stretch"
336+ VerticalContentAlignment =" Stretch"
337+ HorizontalContentAlignment =" Stretch" />
338+ </Border >
339+
340+ <ContentPresenter x : Name =" ProgressPresenter"
341+ Content =" {Binding RelativeSource={RelativeSource TemplatedParent}, Path=State.Progress}"
342+ ContentTemplate =" {TemplateBinding ProgressTemplate}"
343+ HorizontalAlignment =" Stretch"
344+ VerticalAlignment =" Stretch"
345+ VerticalContentAlignment =" Stretch"
346+ HorizontalContentAlignment =" Stretch"
347+ Visibility =" Collapsed"
348+ Opacity =" 1" />
349+ </Grid >
350+ </ControlTemplate >
351+ </Setter .Value>
352+ </Setter >
353+ </Style >
354+ </ResourceDictionary >
0 commit comments