Skip to content

Commit

Permalink
Disable TextMate code coloring for ShowMeTheXaml. #359. Fix #361
Browse files Browse the repository at this point in the history
  • Loading branch information
SKProCH committed Mar 30, 2024
1 parent 415db0f commit aa48a4c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Material.Avalonia.Demo/Material.Avalonia.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@
<ItemGroup>
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>

<ItemGroup>
<Compile Update="Styles\ShowMeTheXamlStyles.XamlDisplayAvaloniaEditThemeBehavior.cs">
<DependentUpon>ShowMeTheXamlStyles.axaml</DependentUpon>
</Compile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Runtime.InteropServices;
using ShowMeTheXaml.Avalonia.AvaloniaEdit;

namespace Material.Avalonia.Demo.Styles;

public class CustomXamlDisplayAvaloniaEditThemeBehavior : XamlDisplayAvaloniaEditThemeBehavior {
protected override void OnAttachedToVisualTree() {
if (RuntimeInformation.ProcessArchitecture == Architecture.Wasm) {
return;
}
base.OnAttachedToVisualTree();
}

protected override void OnDetachedFromVisualTree() {
if (RuntimeInformation.ProcessArchitecture == Architecture.Wasm) {
return;
}
base.OnDetachedFromVisualTree();
}
}
7 changes: 4 additions & 3 deletions Material.Avalonia.Demo/Styles/ShowMeTheXamlStyles.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:avaloniaEdit="https://github.com/avaloniaui/avaloniaedit"
xmlns:avaloniaEdit1="clr-namespace:ShowMeTheXaml.Avalonia.AvaloniaEdit;assembly=ShowMeTheXaml.Avalonia.AvaloniaEdit"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXaml;assembly=ShowMeTheXaml.Avalonia"
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles">
xmlns:controls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles"
xmlns:styles="clr-namespace:Material.Avalonia.Demo.Styles">
<StyleInclude Source="avares://ShowMeTheXaml.Avalonia.AvaloniaEdit/XamlDisplayStyles.axaml" />

<Style Selector="showMeTheXaml|XamlDisplay">
Expand Down Expand Up @@ -38,7 +39,7 @@
Background="{Binding $parent[showMeTheXaml:XamlDisplay].Background}">
<Interaction.Behaviors>
<avaloniaEdit1:CustomizeEditorBehavior />
<avaloniaEdit1:XamlDisplayAvaloniaEditThemeBehavior />
<styles:CustomXamlDisplayAvaloniaEditThemeBehavior />
</Interaction.Behaviors>
</avaloniaEdit:TextEditor>
</ScrollViewer>
Expand Down Expand Up @@ -98,7 +99,7 @@
<avaloniaEdit1:CustomizeEditorBehavior />
<avaloniaEdit1:XamlDisplayAvaloniaEditTextBindingBehavior
MarkupTextEditor="{Binding ElementName=MarkupTextEditor}" />
<avaloniaEdit1:XamlDisplayAvaloniaEditThemeBehavior />
<styles:CustomXamlDisplayAvaloniaEditThemeBehavior />
</Interaction.Behaviors>
</avaloniaEdit:TextEditor>
</ScrollViewer>
Expand Down

0 comments on commit aa48a4c

Please sign in to comment.