Skip to content

Commit c63eee9

Browse files
authored
Merge branch 'master' into master
2 parents 5959d34 + 1ad70b4 commit c63eee9

File tree

6 files changed

+118
-80
lines changed

6 files changed

+118
-80
lines changed

Microsoft.Toolkit.HighPerformance/Helpers/Internals/RuntimeHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static unsafe int ConvertLength<TFrom, TTo>(int length)
4242
}
4343
else if (sizeof(TFrom) == 1)
4444
{
45-
return length / sizeof(TTo);
45+
return (int)((uint)length / (uint)sizeof(TTo));
4646
}
4747
else
4848
{

Microsoft.Toolkit.Uwp.SampleApp/Controls/XamlCodeEditor.xaml.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public sealed partial class XamlCodeEditor : UserControl
2121
public static readonly DependencyProperty TextProperty =
2222
DependencyProperty.Register(nameof(Text), typeof(string), typeof(XamlCodeEditor), new PropertyMetadata(string.Empty));
2323

24+
private ThemeListener _themeListener = new ThemeListener();
25+
2426
public XamlCodeEditor()
2527
{
2628
this.InitializeComponent();
@@ -40,7 +42,7 @@ public async void ReportError(XamlExceptionRange error)
4042
// Highlight Error Line
4143
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
4244
range,
43-
new IModelDecorationOptions() { IsWholeLine = true, ClassName = _errorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));
45+
new IModelDecorationOptions() { IsWholeLine = true, ClassName = ErrorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));
4446

4547
// Show Glyph Icon
4648
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
@@ -121,10 +123,12 @@ public string Text
121123

122124
public DateTime TimeSampleEditedLast { get; private set; } = DateTime.MinValue;
123125

124-
private CssLineStyle _errorStyle = new CssLineStyle()
126+
private CssLineStyle ErrorStyle
125127
{
126-
BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6))
127-
};
128+
get => _themeListener.CurrentTheme.Equals(ApplicationTheme.Light) ?
129+
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6)) } :
130+
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0x66, 0x00, 0x00)) };
131+
}
128132

129133
private CssGlyphStyle _errorIconStyle = new CssGlyphStyle()
130134
{

Microsoft.Toolkit.Uwp.UI.Animations/Expressions/CompositionExtensions.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@ public static void SetMotion(this InteractionTrackerInertiaMotion modifier, Expr
221221
modifier.Motion = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
222222
}
223223

224+
/// <summary>
225+
/// Use the value of specified ExpressionNode to determine if this composition conditional value modifier should be chosen.
226+
/// </summary>
227+
/// <param name="modifier">The modifier.</param>
228+
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
229+
public static void SetCondition(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
230+
{
231+
modifier.Condition = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
232+
}
233+
234+
/// <summary>
235+
/// Use the value of specified ExpressionNode as the value for this composition conditional value
236+
/// </summary>
237+
/// <param name="modifier">The modifier.</param>
238+
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
239+
public static void SetValue(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
240+
{
241+
modifier.Value = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
242+
}
243+
224244
/// <summary>
225245
/// Creates the expression animation from node.
226246
/// </summary>

0 commit comments

Comments
 (0)