From 5dbc35812e842d9a30301092eff1b7cb9a348375 Mon Sep 17 00:00:00 2001 From: Scott Kuhl Date: Fri, 13 Sep 2024 15:21:55 -0500 Subject: [PATCH] Updated Without-Default-Options The use of __builder is from an outdated version of Blazor. Blazor now uses templated delegates. - Index.razor updated to use templated delegates. - Without-Default-Options.csproj updated to .net8. --- .../Without-Default-Options/Pages/Index.razor | 84 ++++++++++--------- .../Without-Default-Options.csproj | 2 +- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Pages/Index.razor b/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Pages/Index.razor index ed2e220c..193da38b 100644 --- a/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Pages/Index.razor +++ b/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Pages/Index.razor @@ -9,8 +9,8 @@ @code{ private string DocumentPath { get; set; } = "wwwroot/Data/PDF_Succinctly.pdf"; - SfPdfViewer2 Viewer; - MemoryStream stream; + SfPdfViewer2 Viewer = default!; + MemoryStream stream = default!; // List provide the position and element for the custom toolbar items public List CustomToolbarItems = new List() @@ -24,45 +24,47 @@ // Get the renderfragment element for the custom toolbaritems in the primary toolbar private static RenderFragment GetTemplate(string name) { - return __builder => - { - if (name == "PreviousPage") - { - - - } - else if(name == "NextPage") - { - - - } - else if(name == "Save") - { - - - } - else if(name == "Download") - { - - - } - }; + if (name == "PreviousPage") + { + return @ + ; + } + + if (name == "NextPage") + { + return @ + ; + } + + if (name == "Save") + { + return @ + ; + } + + if (name == "Download") + { + return @ + ; + } + + return _ => { }; } // Click for the custom toolbaritems in the primary toolbar diff --git a/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Without-Default-Options.csproj b/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Without-Default-Options.csproj index 9127c7fa..2fa1ca70 100644 --- a/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Without-Default-Options.csproj +++ b/Toolbar/Custom Toolbar/Primary Custom Toolbar - SfPdfViewer/Without-Default-Options/Without-Default-Options/Without-Default-Options.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable