@@ -529,43 +529,46 @@ Let’s look at the practical code example:
529
529
SfKanban kanban = new SfKanban();
530
530
KanbanViewModel viewModel = new KanbanViewModel();
531
531
kanban.ColumnMappingPath = "Status";
532
- kanban.CardTemplate = new DataTemplate(() =>
533
- {
534
- StackLayout root = new StackLayout()
535
- {
536
- WidthRequest = 250,
537
- Orientation = StackOrientation.Vertical,
538
- Padding = new Thickness(10),
539
- BackgroundColor = Colors.Gray
540
- };
541
-
542
- HorizontalStackLayout titleLayout = new HorizontalStackLayout();
543
- Label title = new Label()
544
- {
545
- TextColor = Colors.Silver,
546
- HorizontalOptions = LayoutOptions.Start
547
- };
548
- title.SetBinding(Label.TextProperty, new Binding("Title"));
549
- titleLayout.Children.Add(title);
550
-
551
- StackLayout contentLayout = new StackLayout()
552
- {
553
- Orientation = StackOrientation.Horizontal
554
- };
555
- Label desc = new Label()
556
- {
557
- WidthRequest = 150,
558
- FontSize = 14,
559
- TextColor = Colors.Silver,
560
- LineBreakMode = LineBreakMode.WordWrap
561
- };
562
- desc.SetBinding(Label.TextProperty, new Binding("Description"));
563
- contentLayout.Children.Add(desc);
564
-
565
- root.Children.Add(titleLayout);
566
- root.Children.Add(contentLayout);
567
- return root;
568
- });
532
+ kanban.CardTemplate = new DataTemplate(() =>
533
+ {
534
+ StackLayout stackLayout = new StackLayout()
535
+ {
536
+ WidthRequest = 250,
537
+ Orientation = StackOrientation.Vertical,
538
+ Padding = new Thickness(10),
539
+ BackgroundColor = Colors.Gray
540
+ };
541
+
542
+ HorizontalStackLayout titleLayout = new HorizontalStackLayout();
543
+ Label title = new Label()
544
+ {
545
+ TextColor = Colors.Silver,
546
+ HorizontalOptions = LayoutOptions.Start
547
+ };
548
+
549
+ title.SetBinding(Label.TextProperty, new Binding("Title"));
550
+ titleLayout.Children.Add(title);
551
+
552
+ StackLayout contentLayout = new StackLayout()
553
+ {
554
+ Orientation = StackOrientation.Horizontal
555
+ };
556
+
557
+ Label description = new Label()
558
+ {
559
+ WidthRequest = 150,
560
+ FontSize = 14,
561
+ TextColor = Colors.Silver,
562
+ LineBreakMode = LineBreakMode.WordWrap
563
+ };
564
+
565
+ description.SetBinding(Label.TextProperty, new Binding("Description"));
566
+ contentLayout.Children.Add(description);
567
+
568
+ stackLayout.Children.Add(titleLayout);
569
+ stackLayout.Children.Add(contentLayout);
570
+ return stackLayout;
571
+ });
569
572
570
573
kanban.ItemsSource = viewModel.Cards;
571
574
this.Content = kanban;
0 commit comments