Skip to content

Template Creation is not working properly with HotDesing #35

Closed
4 of 4 issues completed
Closed

Description

@DevTKSS

Current behavior

The Generator is not doing e.g. DataTemplate or ControlTemplate in some resources or even in tag of the control itself.
The created things are added INSIDE other elements which naturally resulting in not longer working properly if happening.
Not clear what I mean? See this video made from exactly what I am expirencing happening:

Unbenanntes.Video.Mit.Clipchamp.erstellt.4.mp4

It is not even telling, that it has produced problems only the "no changes to be applyed" which is not at all the case XD

Expected behavior

Maybe some DataTemplate in HeaderTemplate like it was told, or even in the resources via x:Key, also possible way to do.

Which tool(s) are affected?

No response

How to reproduce it (as minimally and precisely as possible)

See the video attached in the current behaviour

Workaround

you can use it, but be aware, that you will have to sort the propertys added afterwards to the correct place (okay, maybe just do not create templates with it at this point, saves nerves ;) )

Affected platforms

Desktop (Skia)

Uno.Sdk version

5.5.54

IDE used

Visual Studio 2022

IDE version

17.12.3

Uno Platform Extension version

1.0

Relevant plugins

No response

Anything else we need to know?

I did delete some stackpanels which has been duplicated added (I did not see it did add them already, not tool fault) before which resulted in a known issue #29 and can a starting source of this issue be, which started to confuse the tool to finally lead to this.

Sub-issues

Sub-issues

4 of 4 Issues completed
Loading 4 sub-issues

Activity

  1. added
    triage/untriaged
    on Dec 14, 2024
  2. nickrandolph commented on Dec 17, 2024

    @nickrandolph

    @DevTKSS template creation is being updated to be more reliable. You can check out the latest uno.sdk (dev) version to see how it is evolving.

  3. removed
    triage/untriaged
    on Dec 17, 2024
  4. DevTKSS commented on Dec 18, 2024

    @DevTKSS
    Author

    @nickrandolph may you could please explain what exactly you do mean with "dev" prefix? Not seen anything like this in the versioning til now and for doing as requested I need to know this from you

  5. nickrandolph commented on Dec 20, 2024

    @nickrandolph

    In global.json you can set the uno.sdk version number. Normally this would be set to a stable version number (eg 5.5.56). If you want to try out the latest "dev" version (ie a prerelease version) you can update the uno.sdk to the latest version listed on nuget.org (https://www.nuget.org/packages/Uno.Sdk) which at this time is 5.6.0-dev.298

  6. DevTKSS commented on Jan 3, 2025

    @DevTKSS
    Author

    Not solved, but could maybe be parially resulting of same souce like #29 with the deleting issue. Would maybe review this issue here again if that one is fixed?

  7. DevTKSS commented on Jan 4, 2025

    @DevTKSS
    Author

    @nickrandolph tryed NavigationView.HeaderTemplate DataTemplate Createion with 5.6.0-dev.298
    getting this output:

    warn: Uno.UI.HotDesign.Client.AppUpdater[0]
          Failed to SET local property: object not found at path.
    fail: Uno.UI.HotDesign.XamlQuerier[0]
          Unable to find element in XAML : 'C:/Users/TKSSonja/Projects/UnoApp1/UnoApp1/Presentation/MainPage.xaml#ID7c2146cb0d624e098f080ceb00aef7dc7c2146cb0d624e098f080ceb00aef7dcImage40539104'
    fail: Uno.UI.HotDesign.Client.XamlUpdates.ShadowXamlDom[0]
          Failed to get original XAML from Shadow XD for element 'C:/Users/TKSSonja/Projects/UnoApp1/UnoApp1/Presentation/MainPage.xaml#ID7c2146cb0d624e098f080ceb00aef7dc7c2146cb0d624e098f080ceb00aef7dcImage40539104'. Error: Unable to find element in XAML : 'C:/Users/TKSSonja/Projects/UnoApp1/UnoApp1/Presentation/MainPage.xaml#ID7c2146cb0d624e098f080ceb00aef7dc7c2146cb0d624e098f080ceb00aef7dcImage40539104'
    

    and everything it did add:

              <NavigationView.HeaderTemplate>
                  <DataTemplate>
                      <Grid ColumnDefinitions="Auto,Auto">
                        <AppBarButton />
                        <Image />
                      </Grid>
                  </DataTemplate>
              </NavigationView.HeaderTemplate>
    

    tryed to add different things:

    • Navigation like Request but also Region
    • Image Source from UnoImage in assets
    • Command Bound to MainViewModel which was visible in the Bindings Panel in Studio
    • Image Position in the Grid -> Column 1 would have been the correct place

    the toastMessage I got when it tryed to update was something with readonly list, but I am not quick enough to catch this on video, sorry...

  8. added this to the 2025 Feedback milestone on Feb 12, 2025
  9. nickrandolph commented on Feb 12, 2025

    @nickrandolph

    @carldebilly can you confirm that with the latest changes to templates that this has been addressed

  10. agneszitte commented on Mar 7, 2025

    @agneszitte
    Member

    Hi @DevTKSS !

    Could you confirm if you're still encountering this issue with the latest Uno Platform Visual Studio Extension version 5.6.40.64 and latest Uno.Sdk 5.6.45?

    These versions were released alongside our latest Hot Design Public Beta announcement.

    Thanks! 😊

  11. DevTKSS commented on Mar 7, 2025

    @DevTKSS
    Author

    @agneszitte I wanted to check yesterday after hearing the announcement on discord, but after using the configuration arguments like --skip on uno-check for a test of the available arguments I am now running into issue with it because it keeps skipping...

    Uno Platform Check.txt

    checked the presets for studio to see if those are possibly influencing the things studio needs and would tell they should not. could you check if this assumtion is right or if those could cause issues with it? runned dotnet new install uno.templates and provided check and updated the extension alongside with visual studio itself, so beside those checks should everything be up to date...

    before this update I have had still issues, so lets have a look with the update...

  12. DevTKSS commented on Mar 8, 2025

    @DevTKSS
    Author

    hm... so generally the app creation Uno Platform output does look a bit strange... would not expect it to log dbug in a general project wizard creation, that might not look so good in a business app development szenario 😅

    Uno Platform Template Launching Uno.txt

    the xmlns EOL issue is not longer happening successfully 👍

    checked now with current templates and updates and... would say its creating one, BUT not relyable and buggy.

    Binding is one of the issue points in Template creation:

    • creating a template and adding controls on it is resulting in exceptions in the console because of it seems to not know a xaml name or so. See the first txt file for the actual output
    • the connecting between the template and its bound value is not intitiv, its not clear at all how to do this without the ancestor or itemscontrolbinding. Might be, because I did learn so far, to place the templates in the control.Resources or Page.Resources name a key and datatype and add them from there with a staticresource, but with the workflow studio is doing it... is a bit complicated. I think it could be better, at least when binding some itemssource, if a default itemtype could be considered, like on the navigationview a navigationviewitem as default preset? like you always have this grid inside of that template, it could add this by default inside of it as better startingpoint if it is in a navigationview.menuitem e.g.
    • trying to place a expander control inside of this template we want to create is not working
    • AncestorBinding and ItemsControlBinding is not available
    • If there are Model changes made while running studio its not recognizing those changes and we need to restart the debug mode to get those into view (this is the txt file with 1 at the end)

    I did a screencast, but clipchamp (Microsofts default) did not record the App 🙄 so I will do those parts again with other software to show you whats happening and what I am trying to do so its happening. Until them I can only add the console outputs while runtime which are really not pretty (because stacktraces of exceptions) and the video where you can (sorry) only see that code parts it did create in the background after ending debug mode.
    current video was too big to upload, here is a link to it on my onedrive
    did already cut most of the parts out where, because of the named recording issue you could only see the mouse but not the window of the app.

    Microsoft Visual Studio-Debugging-Konsole.txt

    Microsoft Visual Studio-Debugging-Konsole1.txt

  13. DevTKSS commented on Mar 8, 2025

    @DevTKSS
    Author

    @agneszitte here you have the created project
    UnoApp6_HotDesign_TemplateIssue35.zip and the video with explaination what is effektiv not working with the template creation at this point from my point of view, so you can see how to repro this and some suggestions to consider for solution. And here the consoleoutput which maybe tells you more (dont know if its same like yesterday

    Microsoft Visual Studio-Debugging-Konsole3.txt

  14. agneszitte commented on Mar 10, 2025

    @agneszitte
    Member

    Hi @DevTKSS, Thank you for your feedback!
    I'll review the details you've shared to better understand your current issues and blockers. I'll follow up with you regarding any questions I may have as needed.

  15. DevTKSS commented on Mar 19, 2025

    @DevTKSS
    Author

    @agneszitte Just an idea, but to that issue the studio engine is having problems identifying an xaml item, what about if that would be done similar to the winforms designer and adding a default name like button1, button2 ...? This way it might also be a solution for #70 probably

  16. DevTKSS commented on May 13, 2025

    @DevTKSS
    Author

    @agneszitte tryed today with a TabBar.HeaderTemplate, sadly not state-able as resolved... maybe the following details helping you/team to fix it in the future?

    Image

    Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.UI.Xaml.UIElement.TryInvokeKeyboardAccelerator(DependencyObject pFocusedElement, UIElement pElement, VirtualKey key, VirtualKeyModifiers keyModifiers, Boolean& handled, Boolean& handledShouldNotImpedeTextInput) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.mux.cs:line 682
       at Microsoft.UI.Xaml.UIElement.TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.mux.cs:line 811
       at Microsoft.UI.Xaml.Controls.MenuFlyout.OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\Controls\MenuFlyout\MenuFlyout.cs:line 356
       at Microsoft.UI.Xaml.Controls.Primitives.FlyoutBase.TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\Controls\Flyout\FlyoutBase.mux.cs:line 11
       at Microsoft.UI.Xaml.UIElement.OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.mux.cs:line 778
       at Microsoft.UI.Xaml.UIElement.RaiseProcessKeyboardAcceleratorsStatic(UIElement pUIElement, VirtualKey key, VirtualKeyModifiers keyModifiers, Boolean& pHandled, Boolean& pHandledShouldNotImpedeTextInput) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.mux.cs:line 759
       at Microsoft.UI.Xaml.Input.KeyboardAcceleratorUtility.ProcessKeyboardAccelerators(VirtualKey originalKey, VirtualKeyModifiers keyModifiers, VectorOfKACollectionAndRefCountPair allLiveAccelerators, DependencyObject pElement, Boolean& pHandled, Boolean& pHandledShouldNotImpedeTextInput, DependencyObject pFocusedElement, Boolean isCallFromTryInvoke) in C:\a\1\s\src\Uno.UI\UI\Xaml\Input\KeyboardAccelerator\KeyboardAcceleratorUtility.mux.cs:line 188
       at Microsoft.UI.Xaml.Controls.Control.ProcessAcceleratorsIfApplicable(KeyRoutedEventArgs spArgsAsKEA, Control pSenderAsControl) in C:\a\1\s\src\Uno.UI\UI\Xaml\Controls\Control\Control.mux.cs:line 206
       at Microsoft.UI.Xaml.Controls.Control.<>c.<.cctor>b__388_32(Object sender, KeyRoutedEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\Controls\Control\Control.cs:line 1095
       at Microsoft.UI.Xaml.UIElement.InvokeHandler(Object handler, RoutedEventArgs args) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.RoutedEvents.cs:line 999
       at Microsoft.UI.Xaml.UIElement.InvokeHandlers(IList`1 handlers, RoutedEventArgs args, Boolean& isHandled) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.RoutedEvents.cs:line 954
       at Microsoft.UI.Xaml.UIElement.RaiseEvent(RoutedEvent routedEvent, RoutedEventArgs args, BubblingContext ctx) in C:\a\1\s\src\Uno.UI\UI\Xaml\UIElement.RoutedEvents.cs:line 636
       at Uno.UI.Xaml.Core.InputManager.KeyboardManager.OnKey(KeyEventArgs args, Boolean down) in C:\a\1\s\src\Uno.UI\UI\Xaml\Internal\InputManager.Keyboard.skia.cs:line 80
       at Uno.UI.Xaml.Core.InputManager.KeyboardManager.<Init>b__3_0(Object _, KeyEventArgs e) in C:\a\1\s\src\Uno.UI\UI\Xaml\Internal\InputManager.Keyboard.skia.cs:line 50
       at Uno.UI.Runtime.Skia.Win32.Win32WindowWrapper.OnKey(WPARAM wParam, LPARAM lParam, Boolean down)
       at Uno.UI.Runtime.Skia.Win32.Win32WindowWrapper.WndProcInner(HWND hwnd, UInt32 msg, WPARAM wParam, LPARAM lParam)
       at Uno.UI.Runtime.Skia.Win32.Win32WindowWrapper.WndProc(HWND hwnd, UInt32 msg, WPARAM wParam, LPARAM lParam)
       at Windows.Win32.PInvoke.DispatchMessage(MSG* lpMsg)
       at Uno.UI.Runtime.Skia.Win32.Win32Host.RunLoop()
       at Uno.UI.Hosting.UnoPlatformHost.RunCore() in C:\a\1\s\src\Uno.UI\Hosting\UnoPlatformHost.cs:line 16
       at Uno.UI.Hosting.UnoPlatformHost.Run() in C:\a\1\s\src\Uno.UI\Hosting\UnoPlatformHost.cs:line 21
       at DevTKSS.Uno.Samples.MvuxGallery.Program.Main(String[] args)
    
    C:\Users\Sonja\source\repos\DevTKSS\DevTKSS.Uno.SampleApps\src\DevTKSS.Uno.Samples.MvuxGallery\bin\Debug\net9.0-desktop\DevTKSS.Uno.Samples.MvuxGallery.exe (process 17552) exited with code 0 (0x0).
    To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
    Press any key to close this window . . .
    

    Code in the Page:

            <Expander Grid.Row="2"
                      ExpandDirection="Down"
                      MaxHeight="400"
                      Content="{Binding CurrentCodeSample, Mode=OneWay}">
                <Expander.ContentTemplate>
                    <DataTemplate>
                        <ScrollViewer>
                            <TextBlock Text="{Binding }"
                                       TextWrapping="WrapWholeWords" />
                        </ScrollViewer>
                    </DataTemplate>
                </Expander.ContentTemplate>
                <Expander.Header>
                    <utu:TabBar VerticalAlignment="Bottom"
                                ItemsSource="{Binding CodeSampleOptions}"
                                SelectedItem="{Binding SelectedOption, Mode=TwoWay}">
                        <utu:TabBar.ItemTemplate>
                            <DataTemplate>
                                <utu:TabBarItem Content="{Binding}"
                                                Command="{Binding SwitchCodeSampleAsync}"
                                                CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Content}"
                                                Style="{StaticResource MaterialTopTabBarItemStyle}"
                                                Icon="Home" />
                            </DataTemplate>
                        </utu:TabBar.ItemTemplate>
                    </utu:TabBar>
                </Expander.Header>
                <Expander.HeaderTemplate>
                    <DataTemplate>
                        <Grid>
                            <utu:TabBar />
                        </Grid>
                    </DataTemplate>
                </Expander.HeaderTemplate>
            </Expander>

    target was, to replace the current hard coded Header with a HeaderTemplate
    How to reproduce:

    1. click on right Properties panel "Templates>HeaderTemplate>Create"
    2. see on the left the default Grid (why not DataTemplate?)
    3. Add a TabBar control
    4. Drag the new added TabBar upwards to the same level as the Grid with the intention to replace the Grid with TabBar
    5. click on Grid for telling it, its not longer wanted
    6. Exception as shown above

    used this Project (link to commit)

    was on refactoring the Expander to use DataTemplate because the Expander like this would be used at multiple pages (see e.g. DashboardPage on the linked Repository) so it made sense to me, to have the Contents at least moved to RessourcesDictionary, since I am till this point not able to define own ControlTemplates when they would use a Command to bind them to. (like the TabBarItem). Since it did work like this in Dashboard Page, I was hopefull Studio could hint me how I should do it, but... nah... :(

    the "missing" nuget is this one, which is set to private but just because of its beeing part of #2734

    nuget

    page tryed it with: ListboardPage - Expander at the bottom

  17. self-assigned this
    on May 19, 2025
  18. nickrandolph commented on Jun 30, 2025

    @nickrandolph

    Closing this issue now and will continue to follow up other related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions