listview


HeaderTemplate Design-Data Crashes XAML Designer


I am building a UWP app and on a specific page of this app I have a ListView. I am binding this ListView's ItemsSource to a CollectionViewSource so that I can enable group headers. This is working just perfectly when I deploy the app to either an emulator or to actual hardware. However, in the XAML Designer, the page displays an empty list. I am using XML data sets to provide design-data on other pages of my app, but for some reason doing so on this page causes the XAML Designer to crash.
Sometimes the designer doesn't crash, and when that happens it renders the list items correctly, but the headers are all scaled way too big and are overlapping the other content on the page (note again, this only happens in the designer, it is fine at runtime). Attempting to interact with the designer when it is in this state causes the XDesProc.exe process to start eating 30%-40% CPU and promptly freezes both the Designer and Visual Studio itself until it either crashes or I manually kill the process in the Task Manager.
Looking in the Windows Event Viewer, I see the following stack trace:
Application: XDesProc.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException at Windows.UI.Xaml.Hosting.XamlUIPresenter.Render() at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.Views.WindowsUIXamlImageHost.RenderWorker() at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.Views.WindowsUIXamlImageHost+RenderScheduler.OnRender(System.Object) at
[Remainder trimmed for brevity, but can be included on request]
I've found that if I remove the d:Source attribute from the CollectionViewSource OR remove the entire ListView.GroupStyle section, that the Designer no longer crashes, but of course in the case of the former I have no design data, (in fact, no visible text of any kind) and in the case of the latter I no longer have headers. Relevant XAML below:
<Page.Resources>
<ResourceDictionary>
<CollectionViewSource x:Name="GroupedRoomsSource"
Source="{x:Bind ViewModel.RoomGroups, Mode=OneWay}"
IsSourceGrouped="True"
ItemsPath="Rooms"
d:Source="{Binding RoomGroups, Source={d:DesignData Source=/SampleData/RoomsViewModelSampleData.xaml}}"/>
</ResourceDictionary>
</Page.Resources>
<ListView x:Name="RoomList"
Grid.Row="0"
ItemsSource="{Binding Source={StaticResource GroupedRoomsSource}}">
<ListView.GroupStyle>
<GroupStyle HidesIfEmpty="True">
<GroupStyle.HeaderTemplate>
<DataTemplate x:DataType="models:RoomGroup">
<TextBlock Text="{x:Bind Header}"
Foreground="White"
FontSize="24" />
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListView.GroupStyle>
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:Room">
<StackPanel>
<TextBlock Text="{x:Bind Name}"
Foreground="White" />
<TextBlock Text="{x:Bind Team.Name}"
Foreground="LightGray"
FontSize="10" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
My question is simply, what am I doing wrong? What about my GroupStyle.HeaderTemplate does the XAML Designer really not like? I would be fine with getting rid of the design data in favor of control ToString text placeholders, as long as I have something to look at when I'm designing the page (which right now, it's either design data or nothing and I'm not sure why). Any help either figuring out what's going wrong or pointing me in the direction of where to look would be greatly appreciated.
My code is all open source at https://github.com/Drakmyth/Hipstr with the page in question at https://github.com/Drakmyth/Hipstr/tree/master/Hipstr.Client/Views/Rooms
Posting this as an answer for those who may come across similar issues. As far as I can tell, the XAML Designer simply does not support design data when using a CollectionViewSource. It does not handle it properly and becomes very unstable when doing so. I have tried this again in VS2017, but with no improvement. I have resorted to just not using design data. Thankfully, with VS2017 supporting Edit and Continue for XAML, design data is not as crucial as it once was.

Related Links

how to set image to ImageView inside ListView in Xamarin?
Sencha Touch consecutive listviews double back buttons issue
Listview loaded twice
Different height in ListView
How to set selected item of ListView without scrolling the view
Can't update data from Kendo DataSource
Closed or circular Vertical ListView Android
How to set layout for topEmptyRegion in WearablListView?
How to disable groupedlist i.e. SemanticZoom+ListView virtualization in WP8.1 WinRT?
Listview item with NM_CUSTOMDRAW is flickering
How to stretch ListView items width to fill parent container?
POSH: Export Listview to CSV
Unable to receive all NM_CUSTOMDRAW dwDrawStage for a ListView
Custom ListView in SharePoint 2013 app
How to adjust size of Horizontal ListView in Xamarin.Forms?
xamarin android - listView never populates

Categories

HOME
keycloak
activiti
office365api
cmd
dxl
jxls
node-notifier
cloudkit
modx-revolution
mapserver
jplayer
static-libraries
openrefine
tostring
alpine
custom-wordpress-pages
java-3d
errorlevel
facebook-instant-articles
devops
blazemeter
cas
virtualdub
phpfox
rst2pdf
xacml
gitignore
preg-match-all
jspresso
webtest
asset-pipeline
textmate
http-referer
mpmediaquery
gesture
event-driven
az-application-insights
android-fingerprint-api
sas-visual-analytics
texmaker
eigenvalue
bootstrap-dialog
sas-jmp
chain-builder
jedis
pango
rdfs
mplayer
colorama
account-kit
query-performance
topbeat
specrun
abcpdf9
static-ip-address
android-fonts
savon
thrust
angstrom-linux
yaws
apachebench
php-internals
system.management
ruby-2.2
simple-framework
kcachegrind
sankey-diagram
census
clipperlib
sorl-thumbnail
asp.net-web-api-odata
xcode-6.2
wp-query
system.net.webexception
hippomocks
picturefill
hyprlinkr
concurrent-collections
centos5
mcts
prettify
jplaton
delphi-6
tinn-r
chuck
wse3.0
netbeans-6.9
data-loss
heartbeat
jmock
preference
sef
photoshop-cs4
ti-dsp
django-notification

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App