Skip to content

Commit 05a28e8

Browse files
committed
Added UWP Example for Listviews
1 parent 4163ee9 commit 05a28e8

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

docs/xaml-tools/xaml-designtime-data.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ You can set a design-time Source for images that are bound to the page or loaded
6161
6262
## Design-time data for ListViews
6363

64-
ListViews are a popular way to display data in your Desktop app. However, they're difficult to visualize without any data. You can use this feature to create an inline design-time data ItemSource. The XAML Designer displays what is in that array in your ListView at design time. This is an example for WPF .NET Core. To use the system:String type, make sure you include
64+
ListViews are a popular way to display data in your Desktop app. However, they're difficult to visualize without any data. You can use this feature to create an inline design-time data ItemSource or Items. The XAML Designer displays what is in that array in your ListView at design time.
65+
66+
### WPF .NET Core Example
67+
To use the system:String type, make sure you include
6568
`xmlns:system="clr-namespace:System;assembly=mscorlib` in your XAML header.
6669

6770
```xml
@@ -132,6 +135,23 @@ xmlns:models="clr-namespace:Cities.Models"
132135

133136
The benefit here is that you can bind your controls to a design-time static version of your model.
134137

138+
### UWP Example
139+
140+
x:Array is not supported in UWP. Therefore we can use `<d:ListView.Items>` instead. To use the system:String type, make sure you include
141+
`http://schemas.microsoft.com/winfx/2009/xaml` in your XAML header.
142+
143+
```xml
144+
<StackPanel>
145+
<ListView>
146+
<d:ListView.Items>
147+
<system:String>Item One</system:String>
148+
<system:String>Item Two</system:String>
149+
<system:String>Item Three</system:String>
150+
</d:ListView.Items>
151+
</ListView>
152+
</StackPanel>
153+
```
154+
135155
## Use design-time data with custom types and properties
136156

137157
This feature by default works only with platform controls and properties. In this section we go over the steps needed to enable you to use your own custom controls as design-time controls, a new capability available to customers using Visual Studio 2019 version [16.8](/visualstudio/releases/2019/release-notes/) or later. There are three requirements to enable this:

0 commit comments

Comments
 (0)