Skip to content

Commit 3c5db27

Browse files
987993-[Maui Kanban] Sorting example code alignment changes
1 parent 5c7bb01 commit 3c5db27

File tree

2 files changed

+123
-51
lines changed

2 files changed

+123
-51
lines changed

MAUI/ImageEditor/events.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ This [`ImageLoaded`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.ImageEd
1919

2020
{% highlight xaml tabtitle="MainPage.xaml" %}
2121

22-
<imageEditor:SfImageEditor Source="image.png" ImageLoaded = "OnImageLoaded" />
22+
<imageEditor:SfImageEditor Source="image.png"
23+
ImageLoaded = "OnImageLoaded"/>
2324

2425
{% endhighlight %}
2526

2627
{% highlight C# tabtitle="MainPage.xaml.cs" %}
2728

28-
private void OnImageLoaded(object sender, EventArgs e)
29-
{
30-
this.imageEditor.Rotate();
31-
}
29+
private void OnImageLoaded(object sender, EventArgs e)
30+
{
31+
this.imageEditor.Rotate();
32+
}
3233

3334
{% endhighlight %}
3435

@@ -38,23 +39,23 @@ N> [View sample in GitHub](https://github.com/SyncfusionExamples/maui-image-edit
3839

3940
## Annotations deserialized event
4041

41-
This [AnnotationsDeserialized](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.ImageEditor.SfImageEditor.html#Syncfusion_Maui_ImageEditor_SfImageEditor_AnnotationsDeserialized) event occurs when annotations are deserialized onto the image.
42+
This [AnnotationsDeserialized](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.ImageEditor.SfImageEditor.html#Syncfusion_Maui_ImageEditor_SfImageEditor_AnnotationsDeserialized) event occurs when the annotations are deserialized onto the image.
4243

4344
N> `Serialization` and `deserialization` are not applicable for custom annotation views.
4445

4546
{% tabs %}
4647
{% highlight xaml tabtitle="MainPage.xaml" hl_lines="3" %}
47-
<imageEditor:SfImageEditor x:Name="imageEditor"
48-
Source="image.png"
49-
AnnotationsDeserialized="OnAnnotationsDeserialized"/>
48+
<imageEditor:SfImageEditor x:Name="imageEditor"
49+
Source="image.png"
50+
AnnotationsDeserialized="OnAnnotationsDeserialized"/>
5051

5152
{% endhighlight %}
5253
{% highlight C# tabtitle="MainPage.xaml.cs" %}
5354

54-
private async void OnAnnotationsDeserialized(object? sender, EventArgs e)
55-
{
56-
await DisplayAlert("", "Annotations are deserialized", "Ok");
57-
}
55+
private async void OnAnnotationsDeserialized(object? sender, EventArgs e)
56+
{
57+
await DisplayAlert("", "Annotations are deserialized", "Ok");
58+
}
5859

5960
{% endhighlight %}
6061
{% endtabs %}
@@ -69,19 +70,20 @@ N> This is common for Shape and Text annotations.
6970

7071
{% highlight xaml tabtitle="MainPage.xaml" %}
7172

72-
<imageEditor:SfImageEditor Source="image.png" AnnotationSelected = "OnAnnotationSelected" />
73+
<imageEditor:SfImageEditor Source="image.png"
74+
AnnotationSelected = "OnAnnotationSelected"/>
7375

7476
{% endhighlight %}
7577

7678
{% highlight C# tabtitle="MainPage.xaml.cs" %}
7779

78-
private void OnAnnotationSelected(object sender, AnnotationSelectedEventArgs e)
80+
private void OnAnnotationSelected(object sender, AnnotationSelectedEventArgs e)
81+
{
82+
if (e.AnnotationSettings is ImageEditorShapeSettings shapeSettings)
7983
{
80-
if (e.AnnotationSettings is ImageEditorShapeSettings shapeSettings)
81-
{
82-
shapeSettings.Color = Colors.Black;
83-
}
84+
shapeSettings.Color = Colors.Black;
8485
}
86+
}
8587

8688
{% endhighlight %}
8789

@@ -96,16 +98,17 @@ The [`BrowseImage`](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.ImageEdi
9698

9799
{% highlight xaml tabtitle="MainPage.xaml" %}
98100

99-
<imageEditor:SfImageEditor Source="image.png" BrowseImage = "OnImageBrowse" />
101+
<imageEditor:SfImageEditor Source="image.png"
102+
BrowseImage = "OnImageBrowse"/>
100103

101104
{% endhighlight %}
102105

103106
{% highlight C# tabtitle="MainPage.xaml.cs" %}
104107

105-
private void OnImageBrowse(object sender, CancelEventArgs e)
106-
{
107-
e.Cancel = true;
108-
}
108+
private void OnImageBrowse(object sender, CancelEventArgs e)
109+
{
110+
e.Cancel = true;
111+
}
109112

110113
{% endhighlight %}
111114

MAUI/Kanban-Board/Sorting.md

Lines changed: 96 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,64 @@ To enable custom sorting behavior, a valid property name from the [ItemsSource](
3333
This example demonstrates how card positions are updated based on sorting configurations and property mappings.
3434

3535
{% tabs %}
36-
{% highlight XAML hl_lines="3 5" %}
36+
{% highlight XAML hl_lines="2 3 5" %}
3737

38-
<kanban:SfKanban x:Name="kanban"
38+
<kanban:SfKanban x:Name="kanban"
3939
SortingMappingPath="Index"
4040
SortingOrder="Ascending"
4141
ItemsSource="{Binding Cards}"
4242
ColumnMappingPath="Category">
4343
<kanban:SfKanban.CardTemplate>
44-
<DataTemplate >
45-
<Border Stroke="Black" StrokeThickness="1" StrokeShape="RoundRectangle 8" Background="#F3CFCE">
46-
<Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="Auto,*" ColumnSpacing="8" Padding="8">
47-
<HorizontalStackLayout Grid.Row="0" Grid.ColumnSpan="2" Spacing="4" VerticalOptions="Center" HeightRequest="20">
48-
<Label Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding Priority, StringFormat='• {0}'}" FontSize="14" FontAttributes="Bold" TextColor="Orange" VerticalOptions="Center" VerticalTextAlignment="Center" HeightRequest="20"/>
44+
<DataTemplate>
45+
<Border Stroke="Black"
46+
StrokeThickness="1"
47+
StrokeShape="RoundRectangle 8"
48+
Background="#F3CFCE">
49+
<Grid RowDefinitions="Auto,Auto,Auto"
50+
ColumnDefinitions="Auto,*"
51+
ColumnSpacing="8"
52+
Padding="8">
53+
<HorizontalStackLayout Grid.Row="0"
54+
Grid.ColumnSpan="2"
55+
Spacing="4"
56+
VerticalOptions="Center"
57+
HeightRequest="20">
58+
<Label Grid.Row="0"
59+
Grid.ColumnSpan="2"
60+
Text="{Binding Priority, StringFormat='• {0}'}"
61+
FontSize="14"
62+
FontAttributes="Bold"
63+
TextColor="Orange"
64+
VerticalOptions="Center"
65+
VerticalTextAlignment="Center"
66+
HeightRequest="20"/>
4967
</HorizontalStackLayout>
50-
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Title}" FontAttributes="Bold" FontSize="14" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="5"/>
51-
<Label Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Description}" FontSize="12" HorizontalTextAlignment="Center" LineBreakMode="WordWrap" Margin="5"/>
68+
<Label Grid.Row="1"
69+
Grid.ColumnSpan="2"
70+
Text="{Binding Title}"
71+
FontAttributes="Bold"
72+
FontSize="14"
73+
HorizontalTextAlignment="Center"
74+
VerticalTextAlignment="Center"
75+
Margin="5"/>
76+
<Label Grid.Row="2"
77+
Grid.ColumnSpan="2"
78+
Text="{Binding Description}"
79+
FontSize="12"
80+
HorizontalTextAlignment="Center"
81+
LineBreakMode="WordWrap"
82+
Margin="5"/>
5283
</Grid>
5384
</Border>
5485
</DataTemplate>
5586
</kanban:SfKanban.CardTemplate>
56-
<kanban:KanbanColumn Title="Open" Categories="Open"/>
57-
<kanban:KanbanColumn Title="In Progress" Categories="In Progress"/>
58-
<kanban:KanbanColumn Title="Done" AllowDrag="False" Categories="Done"/>
87+
<kanban:KanbanColumn Title="Open"
88+
Categories="Open"/>
89+
<kanban:KanbanColumn Title="In Progress"
90+
Categories="In Progress"/>
91+
<kanban:KanbanColumn Title="Done"
92+
Categories="Done"
93+
AllowDrag="False"/>
5994
<kanban:SfKanban.BindingContext>
6095
<local:SortingViewModel/>
6196
</kanban:SfKanban.BindingContext>
@@ -107,13 +142,13 @@ public class SortingViewModel
107142
public ObservableCollection<CardDetails> Cards { get; set; }
108143
}
109144

145+
{% endhighlight %}
146+
{% endtabs %}
147+
110148
N>
111149
* To apply sorting after a drop operation, handle the [DragEnd](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.SfKanban.html#Syncfusion_Maui_Kanban_SfKanban_DragEnd) event and explicitly call the [RefreshKanbanColumn](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.SfKanban.html#Syncfusion_Maui_Kanban_SfKanban_RefreshKanbanColumn) method. This ensures the column updates to reflect the new card order based on the defined sorting logic.
112150
* When using a custom data model, the default card UI is not applicable. To render the card content, you must define a custom `DataTemplate` using the [CardTemplate](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Kanban.SfKanban.html#Syncfusion_Maui_Kanban_SfKanban_CardTemplate) property.
113151

114-
{% endhighlight %}
115-
{% endtabs %}
116-
117152
### Index-Based Sorting
118153

119154
The index-based approach in the Kanban control allows cards to be dropped at precise positions within a column. Upon dropping, the card's index is updated based on the index of the previous card. Additionally, the index of the next card is incremented relative to the drop position to maintain continuous ordering.
@@ -123,29 +158,63 @@ N> The [SortingMappingPath](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.
123158
The following code example illustrates how cards numeric property updated using the index-based sorting approach.
124159

125160
{% tabs %}
126-
{% highlight XAML hl_lines="2 3" %}
161+
{% highlight XAML hl_lines="2 3 5" %}
127162

128-
<kanban:SfKanban x:Name="kanban"
163+
<kanban:SfKanban x:Name="kanban"
129164
SortingMappingPath="Index"
130165
SortingOrder="Ascending"
131166
ItemsSource="{Binding Cards}"
132167
ColumnMappingPath="Category">
133168
<kanban:SfKanban.CardTemplate>
134-
<DataTemplate >
135-
<Border Stroke="Black" StrokeThickness="1" StrokeShape="RoundRectangle 8" Background="#F3EADC">
136-
<Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="Auto,*" ColumnSpacing="8" Padding="8">
137-
<HorizontalStackLayout Grid.Row="0" Grid.ColumnSpan="2" Spacing="4" VerticalOptions="Center" HeightRequest="20" HorizontalOptions="End">
138-
<Label Text="{Binding Index, StringFormat='Rank #{0}'}" FontSize="14" FontAttributes="Bold" TextColor="#026B6E" VerticalOptions="Center" VerticalTextAlignment="Center" HeightRequest="20"/>
169+
<DataTemplate>
170+
<Border Stroke="Black"
171+
StrokeThickness="1"
172+
StrokeShape="RoundRectangle 8"
173+
Background="#F3EADC">
174+
<Grid RowDefinitions="Auto,Auto,Auto"
175+
ColumnDefinitions="Auto,*"
176+
ColumnSpacing="8"
177+
Padding="8">
178+
<HorizontalStackLayout Grid.Row="0"
179+
Grid.ColumnSpan="2"
180+
Spacing="4"
181+
VerticalOptions="Center"
182+
HeightRequest="20"
183+
HorizontalOptions="End">
184+
<Label Text="{Binding Index, StringFormat='Rank #{0}'}"
185+
FontSize="14"
186+
FontAttributes="Bold"
187+
TextColor="#026B6E"
188+
VerticalOptions="Center"
189+
VerticalTextAlignment="Center"
190+
HeightRequest="20"/>
139191
</HorizontalStackLayout>
140-
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Title}" FontAttributes="Bold" FontSize="14" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="5"/>
141-
<Label Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Description}" FontSize="12" HorizontalTextAlignment="Center" LineBreakMode="WordWrap" Margin="5"/>
192+
<Label Grid.Row="1"
193+
Grid.ColumnSpan="2"
194+
Text="{Binding Title}"
195+
FontAttributes="Bold"
196+
FontSize="14"
197+
HorizontalTextAlignment="Center"
198+
VerticalTextAlignment="Center"
199+
Margin="5"/>
200+
<Label Grid.Row="2"
201+
Grid.ColumnSpan="2"
202+
Text="{Binding Description}"
203+
FontSize="12"
204+
HorizontalTextAlignment="Center"
205+
LineBreakMode="WordWrap"
206+
Margin="5"/>
142207
</Grid>
143208
</Border>
144209
</DataTemplate>
145210
</kanban:SfKanban.CardTemplate>
146-
<kanban:KanbanColumn Title="Open" Categories="Open"/>
147-
<kanban:KanbanColumn Title="In Progress" Categories="In Progress"/>
148-
<kanban:KanbanColumn Title="Done" AllowDrag="False" Categories="Done"/>
211+
<kanban:KanbanColumn Title="Open"
212+
Categories="Open"/>
213+
<kanban:KanbanColumn Title="In Progress"
214+
Categories="In Progress"/>
215+
<kanban:KanbanColumn Title="Done"
216+
Categories="Done"
217+
AllowDrag="False"/>
149218
<kanban:SfKanban.BindingContext>
150219
<local:SortingViewModel/>
151220
</kanban:SfKanban.BindingContext>

0 commit comments

Comments
 (0)