Skip to content

Commit 9883a96

Browse files
committed
Merge branch 'feature/onplatform-xaml-compiler-support' of https://github.com/AvaloniaUI/Avalonia into feature/onplatform-xaml-compiler-support
2 parents 6bd6e9f + 769a51b commit 9883a96

File tree

10 files changed

+24
-33
lines changed

10 files changed

+24
-33
lines changed

src/Avalonia.Diagnostics/Diagnostics/Convetions.cs renamed to src/Avalonia.Diagnostics/Diagnostics/Conventions.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
using System;
2-
using System.Reflection;
3-
using Avalonia.Controls;
4-
using Avalonia.VisualTree;
52

63
namespace Avalonia.Diagnostics
74
{
8-
static class Convetions
5+
internal static class Conventions
96
{
107
public static string DefaultScreenshotsRoot =>
118
System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures, Environment.SpecialFolderOption.Create),

src/Avalonia.Diagnostics/Diagnostics/DevToolsOptions.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using Avalonia.Input;
1+
using Avalonia.Input;
32

43
namespace Avalonia.Diagnostics
54
{
@@ -36,11 +35,11 @@ public class DevToolsOptions
3635
public bool ShowImplementedInterfaces { get; set; } = true;
3736

3837
/// <summary>
39-
/// Allow to customizze SreenshotHandler
38+
/// Allow to customize SreenshotHandler
4039
/// </summary>
4140
/// <remarks>Default handler is <see cref="Screenshots.FilePickerHandler"/></remarks>
4241
public IScreenshotHandler ScreenshotHandler { get; set; }
43-
= Convetions.DefaultScreenshotHandler;
42+
= Conventions.DefaultScreenshotHandler;
4443

4544
/// <summary>
4645
/// Gets or sets whether DevTools should use the dark mode theme

src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.IO;
1+
using System.IO;
32
using System.Linq;
43
using System.Threading.Tasks;
54
using Avalonia.Controls;
@@ -40,7 +39,7 @@ public FilePickerHandler(string? title
4039
/// The default root folder is [Environment.SpecialFolder.MyPictures]/Screenshots.
4140
/// </summary>
4241
public string ScreenshotsRoot { get; }
43-
= Convetions.DefaultScreenshotsRoot;
42+
= Conventions.DefaultScreenshotsRoot;
4443

4544
/// <summary>
4645
/// SaveFilePicker Title

src/Avalonia.Diagnostics/Diagnostics/ViewModels/AvaloniaPropertyViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using Avalonia.Data;
3-
using Avalonia.Media;
43

54
namespace Avalonia.Diagnostics.ViewModels
65
{

src/Avalonia.Diagnostics/Diagnostics/ViewModels/ClrPropertyViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Reflection;
3-
using Avalonia.Media;
43

54
namespace Avalonia.Diagnostics.ViewModels
65
{

src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Collections.ObjectModel;
4-
using System.Collections.Specialized;
54
using System.ComponentModel;
65
using System.Linq;
76
using System.Reflection;
@@ -15,7 +14,7 @@
1514

1615
namespace Avalonia.Diagnostics.ViewModels
1716
{
18-
internal class ControlDetailsViewModel : ViewModelBase, IDisposable
17+
internal class ControlDetailsViewModel : ViewModelBase, IDisposable, IClassesChangedListener
1918
{
2019
private readonly IAvaloniaObject _avaloniaObject;
2120
private IDictionary<object, PropertyViewModel[]>? _propertyIndex;
@@ -46,7 +45,7 @@ public ControlDetailsViewModel(TreePageViewModel treePage, IAvaloniaObject avalo
4645

4746
if (avaloniaObject is StyledElement styledElement)
4847
{
49-
styledElement.Classes.CollectionChanged += OnClassesChanged;
48+
styledElement.Classes.AddListener(this);
5049

5150
var pseudoClassAttributes = styledElement.GetType().GetCustomAttributes<PseudoClassesAttribute>(true);
5251

@@ -250,7 +249,7 @@ public void Dispose()
250249

251250
if (_avaloniaObject is StyledElement se)
252251
{
253-
se.Classes.CollectionChanged -= OnClassesChanged;
252+
se.Classes.RemoveListener(this);
254253
}
255254
}
256255

@@ -325,7 +324,7 @@ private void ControlPropertyChanged(object? sender, PropertyChangedEventArgs e)
325324
}
326325
}
327326

328-
private void OnClassesChanged(object? sender, NotifyCollectionChangedEventArgs e)
327+
void IClassesChangedListener.Changed()
329328
{
330329
if (!SnapshotStyles)
331330
{

src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using System;
22
using System.ComponentModel;
33
using System.Reactive.Linq;
4-
using System.Threading.Tasks;
54
using Avalonia.Controls;
65
using Avalonia.Diagnostics.Models;
76
using Avalonia.Input;
87
using Avalonia.Metadata;
98
using Avalonia.Threading;
10-
using System.Linq;
119

1210
namespace Avalonia.Diagnostics.ViewModels
1311
{
@@ -96,7 +94,9 @@ public bool ShouldVisualizeDirtyRects
9694
changed = false;
9795
}
9896
if (changed)
99-
RaiseAndSetIfChanged(ref _shouldVisualizeDirtyRects, value);
97+
{
98+
RaiseAndSetIfChanged(ref _shouldVisualizeDirtyRects, value);
99+
}
100100
}
101101
}
102102

@@ -331,7 +331,7 @@ public bool ShowImplementedInterfaces
331331
private set => RaiseAndSetIfChanged(ref _showImplementedInterfaces , value);
332332
}
333333

334-
public void ToggleShowImplementedInterfaces(object parametr)
334+
public void ToggleShowImplementedInterfaces(object parameter)
335335
{
336336
ShowImplementedInterfaces = !ShowImplementedInterfaces;
337337
if (Content is TreePageViewModel viewModel)
@@ -340,15 +340,15 @@ public void ToggleShowImplementedInterfaces(object parametr)
340340
}
341341
}
342342

343-
public bool ShowDettailsPropertyType
343+
public bool ShowDetailsPropertyType
344344
{
345345
get => _showPropertyType;
346346
private set => RaiseAndSetIfChanged(ref _showPropertyType , value);
347347
}
348348

349-
public void ToggleShowDettailsPropertyType(object paramter)
349+
public void ToggleShowDetailsPropertyType(object parameter)
350350
{
351-
ShowDettailsPropertyType = !ShowDettailsPropertyType;
351+
ShowDetailsPropertyType = !ShowDetailsPropertyType;
352352
}
353353
}
354354
}

src/Avalonia.Diagnostics/Diagnostics/ViewModels/TreeNode.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Avalonia.Controls.Primitives;
77
using Avalonia.LogicalTree;
88
using Avalonia.Media;
9-
using Avalonia.VisualTree;
109

1110
namespace Avalonia.Diagnostics.ViewModels
1211
{

src/Avalonia.Diagnostics/Diagnostics/Views/ControlDetailsView.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<ColumnDefinition Width="Auto"/>
2020
<!--
2121
When selecting the Application node, we need this trick to hide Layout Visualizer
22-
because when using the GridSplitter it sets the Witdth property of ColumnDefinition
22+
because when using the GridSplitter it sets the Width property of ColumnDefinition
2323
(see https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/GridSplitter.cs#L528)
2424
and if we hide the contents of the column, the space is not reclaimed
2525
(see discussion https://github.com/AvaloniaUI/Avalonia/discussions/6773).
@@ -62,15 +62,15 @@
6262
<DataGridTextColumn Header="Value" Binding="{Binding Value}" />
6363
<DataGridTextColumn Header="Type" Binding="{Binding Type}"
6464
IsReadOnly="True"
65-
IsVisible="{Binding !$parent[UserControl;2].DataContext.ShowDettailsPropertyType}"
65+
IsVisible="{Binding !$parent[UserControl;2].DataContext.ShowDetailsPropertyType}"
6666
/>
67-
<DataGridTextColumn Header="Assinged Type" Binding="{Binding AssignedType, Converter={StaticResource GetTypeName}}"
67+
<DataGridTextColumn Header="Assigned Type" Binding="{Binding AssignedType, Converter={StaticResource GetTypeName}}"
6868
IsReadOnly="True"
69-
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDettailsPropertyType}"
69+
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDetailsPropertyType}"
7070
/>
7171
<DataGridTextColumn Header="Property Type" Binding="{Binding PropertyType, Converter={StaticResource GetTypeName}}"
7272
IsReadOnly="True"
73-
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDettailsPropertyType}"
73+
IsVisible="{Binding $parent[UserControl;2].DataContext.ShowDetailsPropertyType}"
7474
/>
7575
<DataGridTextColumn Header="Priority" Binding="{Binding Priority}" IsReadOnly="True" />
7676
</DataGrid.Columns>

src/Avalonia.Diagnostics/Diagnostics/Views/MainView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
IsEnabled="False" />
5454
</MenuItem.Icon>
5555
</MenuItem>
56-
<MenuItem Header="Split Property Type" Command="{Binding ToggleShowDettailsPropertyType}">
56+
<MenuItem Header="Split Property Type" Command="{Binding ToggleShowDetailsPropertyType}">
5757
<MenuItem.Icon>
5858
<CheckBox BorderThickness="0"
59-
IsChecked="{Binding ShowDettailsPropertyType}"
59+
IsChecked="{Binding ShowDetailsPropertyType}"
6060
IsEnabled="False"/>
6161
</MenuItem.Icon>
6262

0 commit comments

Comments
 (0)