Arthur Lee
Arthur Lee

Reputation: 121

Show grid lines not appearing

I'm trying to make my grid show its gridlines in WPF. In Silverlight, I believe there was a property called grid.showgridlines, but that doesn't exist in Windows Phone 8 WPF. Is there any alternative?

I'd really like to clean up my xaml from having rectangle objects being duplicated a million times over.

Thanks!

Upvotes: 0

Views: 1201

Answers (1)

Peter Duniho
Peter Duniho

Reputation: 70652

I'm assuming that you are writing a Windows Phone app, not a WPF program. That said, the remarks for the Grid.ShowGridLines property in WPF are informative:

Enabling grid lines creates dotted lines around all the elements within a Grid. Only dotted lines are available because this property is intended as a design tool to debug layout problems and is not intended for use in production quality code. If you want lines inside a Grid, style the elements within the Grid to have borders.

(emphasis mine)

In other words, even in WPF it wasn't intended that you use this property in your production code. The advice to style the elements within the Grid control to have borders should work as well in the other XAML APIs (Windows Phone, WinRT).

Upvotes: 1

Related Questions