0

I'm using the DevExpress library to load a bunch of shapes from a SQL server WKT datatable. As far as I am aware they get loaded directly from XAML, so the only thing that I can influence is the ConnectionString path in .CS.

    <dxm:VectorLayer x:Name="WKT_Layer">
    <dxm:SqlGeometryDataAdapter x:Name="WKT_Adapter"
                                SqlText = "SELECT [WKT], [SID],[FILL],[STROKE] FROM [TLORIS]"
                                SpatialDataMember = "WKT"
                                ConnectionString="{Binding WKTConnection}"/>
    </dxm:VectorLayer>

Is there a way to force parts of XAML to load asynchronously, because the program can take up to 8 seconds to start while it loads all 10,000+ shapes? I'm also fine with using a loading spinner, for example WPF loading spinner, but I don't even know how to initialise it, as the UI is essentially frozen while the shapes are loading. I know how to solve this if I could approach it programmatically from .CS, but XAML is for me, for the most part, magic.

Adephx
  • 187
  • 10
  • Not in XAML. You could try to set those properties in an async Loaded event handler in case the SqlGeometryDataAdapter class provides async APIs. In case the class is a Freezable, you may also create it asynchronously (e.g. by Task.Run) and freeze it before adding it to the VectorLayer. – Clemens Jul 30 '20 at 07:51
  • Do they change much? I don't know what a vectorlayer is but bunch of shapes sounds like geometries. Maybe you could translate once or occasionally. Into a plain xaml resource dictionary and merge that. Mind you. I'm not sure how long 10,000 geometries would take to load. – Andy Jul 30 '20 at 08:05
  • As to your spinner. You could show a loading screen with a spinner. Crank up some process creates objects. Merge these into application.current.resources whilst you're showing your spinner. Then navigate to your current starting window. – Andy Jul 30 '20 at 08:07

0 Answers0