Skip to content

Inserting Container Controls not working properly by dragging in the visual tree on the left #79

Open

Description

@DevTKSS

Current behavior

having a Control that does only have one Child Element allowed, it already has a child, but I want now to add something inbetween the current Parent and that child control, HotDesign does insert that control at first, but when trying to drag it at the needed level (which does not allow a second item!) thats making studio fail with "XamlElement not found" while you would have dragged the current child the visual tree down to tell it, you now want it to be nested in its new parent.

Expected behavior

Maybe prompt the user that this control does not allow another child and provide the answer option to tell thats known or not -> "Do you want to move the current child control to be the child of that added Control instead?" which would manage that perfectly

Which tool(s) are affected?

Hot Design™

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

Described above

My Code that was tryed to design:

        <Expander Grid.Row="2"
                  ExpandDirection="Down"
                  MaxHeight="500">
        
            <Expander.Header>
                <utu:TabBar VerticalAlignment="Bottom"
                            Style="{StaticResource TopTabBarStyle}"
                            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.Content>
                <ScrollViewer>
                    <TextBlock x:Name="CodeSampleBlock"
                            Text="{Binding CurrentCodeSample}"
                            TextWrapping="WrapWholeWords"/>
                </ScrollViewer>
            </Expander.Content>
            
        </Expander>

the Content of the CodeSampleBlock was larger as initially expected after binding it, so I wanted to add the ScrollViewer you can see above. The Expander.Content does not allow more children, which is totally fine. I only wanted to add the scrollViewer inbetween like this, so the Page is not overloaded with the TextBlock Content.

Workaround

Use HotReload

Affected platforms

Desktop (Skia)

Uno.Sdk version

5.6.54

IDE used

Visual Studio 2022

IDE version

17.13.6

Uno Platform Extension version

5.6.46.70

Relevant plugins

No response

Anything else we need to know?

No response

Activity

  1. added
    triage/untriaged
    on Apr 24, 2025
  2. nickrandolph commented on Apr 29, 2025

    @nickrandolph

    In the beta releases this was an issue, which should be resolve now

  3. removed
    triage/untriaged
    on Apr 29, 2025
  4. added this to the 2025 Feedback milestone on May 19, 2025
  5. nickrandolph commented on Jul 11, 2025

    @nickrandolph

    @DevTKSS I've been re-reviewing this issue as part of QA and realised that we might not have addressed your scenario entirely. My initial thought was that "add as parent" wasn't working (hence my previous comment), however, I don't believe this was the intent of your original post.
    Can you please elaborate more on the repro steps - please use bullet points to avoid any confusion and indicate both actual outcome and expected outcome. We'll use this to either add a feature to backlog or address it, if it's a bug.
    Thanks

  6. DevTKSS commented on Jul 11, 2025

    @DevTKSS
    Author

    @nickrandolph as I am currently unable to install the uno extension successfully on my laptop (added the issue banner in our discord getting started as I am not finding the opened discussion mentioned to be existing) :( I can not quickly give you a visual sample for this but will try to describe:

    You do see the Expander Control at the bottom of my xaml page there. now lets say initially you would have an expander or any control with a "Content" Property which is in the end of course only allowing 1 children element to be in the content. now you would have added in first step such textblock control to show a text, but then discovered the space your text is taking in, is more then you want the control to take in or you want to not just serve on desktop application that has commonly more space than a mobile target.
    okay, so you would decide to make the expander content scrollable, you would using HD drag drop capability and drag a scrollviewer control into the expander content. now of course that would not work as final result but HD does not provide the capability of a intermediate state which would allow me to drag the textblock into the content of the scrollviewer, or else to ask me, if I would like it to do that for me to solve that

  7. nickrandolph commented on Jul 11, 2025

    @nickrandolph

    In this scenario can't you add the ScrollViewer as a parent of the TextBlock? Or am I missing something about your scenario

  8. nickrandolph commented on Jul 29, 2025

    @nickrandolph

    @DevTKSS can you provide more information on the scenario so I can understand what change we should be making

  9. DevTKSS commented on Jul 30, 2025

    @DevTKSS
    Author

    @nickrandolph sorry missed your reply! Will try today to record it to you so you can see it. Maybe thats better then me trying to describe it.

  10. DevTKSS commented on Jul 30, 2025

    @DevTKSS
    Author

    @nickrandolph okay, so indeed I would have for this another "Container"-like control, which requires me currently to Re-Start instead of Reload, let alone HD. I recorded a Video today, with the main target of showing how to do different things in mvux which included a Grid and FeedView and ListView in the end => of course this requires Property changing (known as skip able excpetion if happening) but the problematic one there is the container control one mentioned here.
    Will link the Video to you, which is un-cut, so far and does not has subtitles, so recommend for better understanding what I am doing there on a possible Windows Host maschine, to enable "Live Subtitles" in your System settings.

    https://technischekonstruktion-my.sharepoint.com/:v:/g/personal/info_technische-konstruktion_com/EeyENAPxEEtHu9UFFqHYoJcBU4gF1IYbFtyfHgxVEaCWMQ?e=DRaJkY

    Your jump marks:

    • started to describe the target result: 00:27:35
    • Model code written ready: 00:33:34
    • Started HD Mode to define the UI in our HD Studio envirionment: 0:34:50
    • Exception thrown in Studio UI we are talking about + different work flows tryed: 00:36:50
      After this last happening you also will see the behind studio window Exceptions of vs.

    Sorry for having minimal loglevel active, but I think this is reproducable. if not, let me know, can do this part also again with suitable loglevel so you may have more log informations

  11. added theissue type on Aug 4, 2025
  12. DevTKSS commented on Sep 4, 2025

    @DevTKSS
    Author

    @nickrandolph / @Jen-Uno do you might have some updates for me about this issue?

    My latest video was having more HD showcase but I don't think showing that issue would not be really good for HD starters to see so I cutted it out...

    Hoping that it will not stay at the state of issue so I could have the next part showing more of the great tooling...

  13. nickrandolph commented on Sep 5, 2025

    @nickrandolph

    @DevTKSS let me review the video and get back to you on how we can address this going forward

  14. DevTKSS commented on Sep 8, 2025

    @DevTKSS
    Author

    @nickrandolph I tryed some issue source idea out right now with Grid as Container which maybe helps you investigate and solve the issue on Grid mentioned before, while I dont think that would solve it for any other Control like initially sampled, where it has only one child control but you planned on re-sort the controls after adding one:

    • start point is the WebAuth Templated App on Desktop Target on the LoginPage
    • Added before starting Debugger the WebView Uno Feature because I wanted to try how HD works/handles WebView2 in general.
    • Now starting the debugger + entering HD
    • While my last (failed) try did right then just drop in another control in a Grid with filled all Columns/Rows we defined, I did now BEFORE I did this add another RowDefinition Array Element (Height Auto in that case)
    • Also updated the Preset StackPanel Row Property Value in the right Properties Panel to now be 2 instead of 1.
    • THEN I did drop into the Elements Panel on the left side between the Preset NavigationBar and the StackPanel into that "empty" Row an WebView2 control from the toolbox
    • Surprised that I got no Exception as before (but I did also not edit the model paralel, just and only that steps listed here) so for notice, we do now have this Studio UI showing to us:
      Image
    • Carefully taken a look into my console, which was still set to in Detailed Output from a issue check before there was showing this output:
    fail: Uno.UI.HotDesign.MessageBroker.HandlerQueue[0]
          Error processing message: 'SelectedElementPropertiesResponseMessage'
          System.NotSupportedException: Serialization and deserialization of 'System.IntPtr' instances is not supported. Path: $.Value.
           ---> System.NotSupportedException: Serialization and deserialization of 'System.IntPtr' instances is not supported.
             at System.Text.Json.Serialization.Converters.UnsupportedTypeConverter`1.Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
             at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             --- End of inner exception stack trace ---
             at System.Text.Json.ThrowHelper.ThrowNotSupportedException(WriteStack& state, Exception innerException)
             at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
             at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.SerializeAsObject(Utf8JsonWriter writer, Object rootValue)
             at Uno.UI.HotDesign.Models.PropertyValueBaseConverter.Write(Utf8JsonWriter writer, PropertyValueBase value, JsonSerializerOptions options)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
             at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter`2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
             at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter`2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
             at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
             at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
             at System.Text.Json.JsonSerializer.WriteStringAsObject(Object value, JsonTypeInfo jsonTypeInfo)
             at Uno.UI.HotDesign.Messages.SerializedMessage.Create(IMessage message)
             at Uno.UI.HotDesign.MessageBroker.SerializeMessage(IHotDesignMessage message)
             at Uno.UI.HotDesign.MessageBroker.SendToServerHandler.ProcessMessage(IHotDesignMessage message)
             at Uno.UI.HotDesign.MessageBroker.HandlerQueue.ProcessItem(IHotDesignMessage message)
             at Uno.UI.HotDesign.AsyncQueueProcessor`1.RunAsync()
    
    

    Not sure if this is okay and expected?

    • Bound the Source Property of the WebView2 control to my LoginModel, where I did register an `IState CurrentUrl => State.Value(this, () => new Uri(...)).
    • then I seen also that HD seems like did not recognize where I put it (yes, in xaml its exactly where I dropped it, between them both) so it did not automatically set the Grid.Row property accordingly to the drop between those two in the Grid Container, maybe that could be considered as improvement?
    • so I changed that Row Property to 1 where I wanted it and suddenly got an Exception:
      Image
      and this in my IDE window:
      Image
    • I did not end the debug session and told it that I want to Edit and "Continue Anyway", exited HD, which did like you could see, not show the before just sometimes hidden behind the NavigationBar Control Instance of WebView2 and suddenly it was all fine there.

    🤔

    My suggestions for the Grid as container Problem would be:

    1. HD should see if the Grid has appropriate Row numbers
    2. If not and even more if we did drop it in the Element Panel to a specific Place, maybe it could adjust the Row Property of that new added control and of course maybe also the already existing ones?
    3. If we might not defined before (like I did now) another Grid.RowDefinitions Member, it should maybe add one, or at least ask us if we want it to do this, but Exceptions are less helpfull ;)
  15. nickrandolph commented on Sep 23, 2025

    @nickrandolph

    @DevTKSS can you confirm which version of uno.sdk you're using for the latest comment.

  16. DevTKSS commented on Sep 23, 2025

    @DevTKSS
    Author

    @nickrandolph I think it was the 6.2.36 but can not look right now onto my computer. You can lookup the version used in the other hd issue you did right before answer that the WebView2 issue with object null. Its the same UnoApp5 repro

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions