Avalonia: Editing contents of a <TabItem> causes the designer to swap back to the first <TabItem>

Created on 14 Sep 2020  路  9Comments  路  Source: AvaloniaUI/Avalonia

Normally in WPF (I believe) when editing the XAML contents of a <TabItem> the designer will switch to that tab so you can see the controls you are adding. I can also switch to this tab by clicking on it in the designer.

In Avalonia, I can click on the tab in the designer but the moment I start modifying the XAML contents of that tab, the designer swaps back to the first tab.

Most helpful comment

there would be special concept for tab control, to change tabs based on what it sees in designer
like scroll scrollviewer to edited item etc.

BringIntoView

All 9 comments

@ForNeVeR @ShadowDancer I guess we could send previewer a message with the cursor position. That way it could identify the active element and activate it in TabControl accordingly

@rstm-sf, isn't it something that you were preparing for the web previewer?

As far as I understand, no. I was just doing mouse handling on preview. Here is a request for the editable element in xaml to be activated in preview

The web part has nothing to do with previewer<->editor communication, it's done via a separate tcp connection.

Why do you think that editor communication is important here? As I understand, this is about keeping control state between XAML updates in previewer. Though, if editor could help with this, them I'm all ears.

when editing the XAML contents of a <TabItem> the designer will switch to that tab

Ah, okay, you're right. Yes, it would be very easy to send current caret position to the previewer. Please consider that all the Avalonia-compatible editors (including VS, VSCode, Rider) have some sort of multi-caret, so it would be cool to be able to highlight multiple carets in future (though this is not that important).

I think this is a bit of over-engineering, because - as I understand it - there would be special concept for tab control, to change tabs based on what it sees in designer. However I think this is not really robust, because next things will soon follow, like scroll scrollviewer to edited item etc.

I think what we really need here is Xaml hot-reload, so user may choose tabitem he wishes, and then find the subtree which needs to be modified and only that subtree is reloaded in previewer. Do we have plans to support it?

there would be special concept for tab control, to change tabs based on what it sees in designer
like scroll scrollviewer to edited item etc.

BringIntoView

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheColonel2688 picture TheColonel2688  路  3Comments

Urgau picture Urgau  路  3Comments

GitHubington picture GitHubington  路  3Comments

CreateLab picture CreateLab  路  3Comments

grokys picture grokys  路  4Comments