提交记录修改UI/Controls/Charts/Charts.cs+56 −7看文件
修改UI/Themes/Charts/Charts.xaml+2 −1看文件
| @@ -123,6 +123,24 @@ namespace UI.Controls.Charts | ||
| 123 | 123 | new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); |
| 124 | 124 | |
| 125 | 125 | |
| 126 | 新增: #endregion | |
| 127 | 新增: | |
| 128 | 新增: #region IsCanScroll 是否可以滚动 | |
| 129 | 新增: /// <summary> | |
| 130 | 新增: /// 是否在加载中 | |
| 131 | 新增: /// </summary> | |
| 132 | 新增: public bool IsCanScroll | |
| 133 | 新增: { | |
| 134 | 新增: get { return (bool)GetValue(IsCanScrollProperty); } | |
| 135 | 新增: set { SetValue(IsCanScrollProperty, value); } | |
| 136 | 新增: } | |
| 137 | 新增: public static readonly DependencyProperty IsCanScrollProperty = | |
| 138 | 新增: DependencyProperty.Register("IsCanScroll", | |
| 139 | 新增: typeof(bool), | |
| 140 | 新增: typeof(Charts), | |
| 141 | 新增: new PropertyMetadata(true, new PropertyChangedCallback(OnPropertyChanged))); | |
| 142 | 新增: | |
| 143 | 新增: | |
| 126 | 144 | #endregion |
| 127 | 145 | #region ClickCommand 点击命令 |
| 128 | 146 | /// <summary> |
| @@ -149,7 +167,7 @@ namespace UI.Controls.Charts | ||
| 149 | 167 | } |
| 150 | 168 | if (e.Property == IsLoadingProperty) |
| 151 | 169 | { |
| 152 | 删除: if (!charts.IsLoading) | |
| 170 | 新增: if (!charts.IsLoading || e.Property == IsCanScrollProperty) | |
| 153 | 171 | { |
| 154 | 172 | charts.Render(); |
| 155 | 173 | } |
| @@ -169,6 +187,7 @@ namespace UI.Controls.Charts | ||
| 169 | 187 | /// 容器 |
| 170 | 188 | /// </summary> |
| 171 | 189 | private StackPanel Container; |
| 190 | 新增: private StackPanel NoScrollContainer; | |
| 172 | 191 | private WrapPanel CardContainer; |
| 173 | 192 | private Grid MonthContainer; |
| 174 | 193 | private ScrollViewer ScrollViewer; |
| @@ -204,6 +223,7 @@ namespace UI.Controls.Charts | ||
| 204 | 223 | CardContainer = GetTemplateChild("CardContainer") as WrapPanel; |
| 205 | 224 | MonthContainer = GetTemplateChild("MonthContainer") as Grid; |
| 206 | 225 | ScrollViewer = GetTemplateChild("ScrollViewer") as ScrollViewer; |
| 226 | 新增: NoScrollContainer = GetTemplateChild("NoScrollContainer") as StackPanel; | |
| 207 | 227 | |
| 208 | 228 | if (IsLoading) |
| 209 | 229 | { |
| @@ -229,7 +249,14 @@ namespace UI.Controls.Charts | ||
| 229 | 249 | case ChartsType.HorizontalA: |
| 230 | 250 | var item = new ChartsItemTypeA(); |
| 231 | 251 | item.IsLoading = true; |
| 232 | 删除: Container.Children.Add(item); | |
| 252 | 新增: if (IsCanScroll) | |
| 253 | 新增: { | |
| 254 | 新增: Container.Children.Add(item); | |
| 255 | 新增: } | |
| 256 | 新增: else | |
| 257 | 新增: { | |
| 258 | 新增: NoScrollContainer.Children.Add(item); | |
| 259 | 新增: } | |
| 233 | 260 | break; |
| 234 | 261 | case ChartsType.Card: |
| 235 | 262 | var card = new ChartsItemTypeCard(); |
| @@ -269,14 +296,27 @@ namespace UI.Controls.Charts | ||
| 269 | 296 | { |
| 270 | 297 | return; |
| 271 | 298 | } |
| 299 | 新增: | |
| 300 | 新增: if (IsCanScroll) | |
| 301 | 新增: { | |
| 302 | 新增: ScrollViewer.Visibility = Visibility.Visible; | |
| 303 | 新增: NoScrollContainer.Visibility = Visibility.Collapsed; | |
| 304 | 新增: } | |
| 305 | 新增: else | |
| 306 | 新增: { | |
| 307 | 新增: ScrollViewer.Visibility = Visibility.Collapsed; | |
| 308 | 新增: NoScrollContainer.Visibility = Visibility.Visible; | |
| 309 | 新增: } | |
| 272 | 310 | Calculate(); |
| 273 | 311 | Container.Children.Clear(); |
| 274 | 312 | CardContainer.Children.Clear(); |
| 275 | 313 | MonthContainer.Children.Clear(); |
| 314 | 新增: NoScrollContainer.Children.Clear(); | |
| 276 | 315 | |
| 277 | 316 | if (Data == null || Data.Count() <= 0) |
| 278 | 317 | { |
| 279 | 318 | Container.Children.Add(new EmptyData()); |
| 319 | 新增: NoScrollContainer.Children.Add(new EmptyData()); | |
| 280 | 320 | CardContainer.Children.Add(new EmptyData()); |
| 281 | 321 | return; |
| 282 | 322 | } |
| @@ -296,7 +336,7 @@ namespace UI.Controls.Charts | ||
| 296 | 336 | } |
| 297 | 337 | |
| 298 | 338 | } |
| 299 | 删除: | |
| 339 | 新增: | |
| 300 | 340 | #region 渲染横向样式A |
| 301 | 341 | private void RenderHorizontalAStyle() |
| 302 | 342 | { |
| @@ -318,8 +358,12 @@ namespace UI.Controls.Charts | ||
| 318 | 358 | lazyloadingData = data; |
| 319 | 359 | ScrollViewer.ScrollChanged += ScrollViewer_ScrollChanged; |
| 320 | 360 | } |
| 321 | 删除: Container.SizeChanged -= Container_SizeChanged; | |
| 322 | 删除: Container.SizeChanged += Container_SizeChanged; | |
| 361 | 新增: | |
| 362 | 新增: if (IsCanScroll) | |
| 363 | 新增: { | |
| 364 | 新增: Container.SizeChanged -= Container_SizeChanged; | |
| 365 | 新增: Container.SizeChanged += Container_SizeChanged; | |
| 366 | 新增: } | |
| 323 | 367 | isRendering = false; |
| 324 | 368 | } |
| 325 | 369 | |
| @@ -355,6 +399,11 @@ namespace UI.Controls.Charts | ||
| 355 | 399 | |
| 356 | 400 | private void RenderTypeAItems(List<ChartsDataModel> data, int start, int count) |
| 357 | 401 | { |
| 402 | 新增: StackPanel container = Container; | |
| 403 | 新增: if (!IsCanScroll) | |
| 404 | 新增: { | |
| 405 | 新增: container = NoScrollContainer; | |
| 406 | 新增: } | |
| 358 | 407 | for (int i = start; i < start + count; i++) |
| 359 | 408 | { |
| 360 | 409 | |
| @@ -373,7 +422,7 @@ namespace UI.Controls.Charts | ||
| 373 | 422 | } |
| 374 | 423 | // 处理点击事件 |
| 375 | 424 | HandleItemClick(chartsItem, item); |
| 376 | 删除: Container.Children.Insert(lazyloadedCount, chartsItem); | |
| 425 | 新增: container.Children.Insert(lazyloadedCount, chartsItem); | |
| 377 | 426 | |
| 378 | 427 | if (ShowLimit > 0 && Container.Children.Count == ShowLimit) |
| 379 | 428 | { |
| @@ -382,7 +431,7 @@ namespace UI.Controls.Charts | ||
| 382 | 431 | lazyloadedCount++; |
| 383 | 432 | if (i >= 20) |
| 384 | 433 | { |
| 385 | 删除: Container.Children.RemoveAt(Container.Children.Count - 1); | |
| 434 | 新增: container.Children.RemoveAt(Container.Children.Count - 1); | |
| 386 | 435 | } |
| 387 | 436 | } |
| 388 | 437 | } |
| @@ -14,10 +14,11 @@ | ||
| 14 | 14 | <Border Background="{TemplateBinding Background}"> |
| 15 | 15 | <Grid> |
| 16 | 16 | <Grid x:Name="HorizontalA" Visibility="Collapsed"> |
| 17 | 删除: <ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Auto" Height="{Binding ElementName=HorizontalA,Path=ActualHeight}" CanContentScroll="False"> | |
| 17 | 新增: <ScrollViewer Visibility="Collapsed" x:Name="ScrollViewer" VerticalScrollBarVisibility="Auto" Height="{Binding ElementName=HorizontalA,Path=ActualHeight}" CanContentScroll="False"> | |
| 18 | 18 | <StackPanel x:Name="Container"> |
| 19 | 19 | </StackPanel> |
| 20 | 20 | </ScrollViewer> |
| 21 | 新增: <StackPanel Visibility="Collapsed" x:Name="NoScrollContainer"></StackPanel> | |
| 21 | 22 | </Grid> |
| 22 | 23 | <Grid x:Name="Card" Visibility="Collapsed"> |
| 23 | 24 | <WrapPanel x:Name="CardContainer"> |

