Skip to content

Commit 1edead7

Browse files
Merge pull request #3555 from syncfusion-content/975705
975705: Add UG content for the DisplayMemberPath Feature in MAUI ListView
2 parents 4229d58 + e354c2f commit 1edead7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

MAUI/ListView/viewappearance.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,22 @@ public class MainPage : ContentPage
101101

102102
![MAUI ListView Data Template Selector](Images/appearance/maui-listview-applying-the-data-template-selector.jpg)
103103

104+
## Setting DisplayMemberPath
105+
106+
The `DisplayMemberPath` property in the SfListView provides a simple and efficient way to display a specific property from business objects without creating custom item template. This feature is especially useful for simple lists where you want to display a single property without defining a custom template.
107+
108+
{% tabs %}
109+
{% highlight xaml tabtitle="MainPage.xaml" %}
110+
<syncfusion:SfListView x:Name="listView"
111+
DisplayMemberPath="BookName" />
112+
{% endhighlight %}
113+
{% highlight c# tabtitle="MainPage.xaml.cs" %}
114+
listView.DisplayMemberPath = "BookName";
115+
{% endhighlight %}
116+
{% endtabs %}
117+
118+
N> The `ItemTemplate` property takes precedence over `DisplayMemberPath`. If both are set, `ItemTemplate` will be used.
119+
104120
## Horizontal ListView
105121

106122
The SfListView allows you to layout every item in the [SfListView.ItemsSource](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.ListView.SfListView.html#Syncfusion_Maui_ListView_SfListView_ItemsSource) property either in `Vertical` or `Horizontal` orientation by setting the [SfListView.Orientation](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.ListView.SfListView.html#Syncfusion_Maui_ListView_SfListView_Orientation). The default orientation is `Vertical`.

0 commit comments

Comments
 (0)