-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into tomlm/accessText
- Loading branch information
Showing
6 changed files
with
93 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<controls:DialogWindow xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
xmlns:controls="clr-namespace:Consolonia.Core.Controls;assembly=Consolonia.Core" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
x:Class="Consolonia.Gallery.View.XamlDialogWindow"> | ||
<ScrollViewer HorizontalScrollBarVisibility="Visible" | ||
VerticalScrollBarVisibility="Visible" | ||
Focusable="True"> | ||
<SelectableTextBlock Name="Xaml" Text="{Binding}" /> | ||
</ScrollViewer> | ||
</controls:DialogWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Linq; | ||
using Avalonia; | ||
using Avalonia.Input; | ||
using Consolonia.Core.Controls; | ||
|
||
namespace Consolonia.Gallery.View | ||
{ | ||
public partial class XamlDialogWindow : DialogWindow | ||
{ | ||
public XamlDialogWindow() | ||
{ | ||
InitializeComponent(); | ||
|
||
AttachedToVisualTree += DialogWindowAttachedToVisualTree; | ||
} | ||
|
||
private void DialogWindowAttachedToVisualTree(object sender, Avalonia.VisualTreeAttachmentEventArgs e) | ||
{ | ||
AttachedToVisualTree -= DialogWindowAttachedToVisualTree; | ||
|
||
var child = this.LogicalChildren.FirstOrDefault(); | ||
if (child is InputElement input) | ||
input.AttachedToVisualTree += OnChildAttachedToVisualTree; | ||
} | ||
|
||
private void OnChildAttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) | ||
{ | ||
if (sender is InputElement input) | ||
{ | ||
input.AttachedToVisualTree -= OnChildAttachedToVisualTree; | ||
input.Focus(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters