Skip to content

Commit dd8d11d

Browse files
committed
Use nameof to pull out some strings
1 parent 5269fdd commit dd8d11d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Microsoft.Toolkit.Uwp.UI.Controls/TileControl/TileControl.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,15 @@ private async Task CreateModuloExpression(ScrollViewer scrollViewer = null)
439439
private void CreateModuloExpression(ScrollViewer scrollViewer, double imageWidth, double imageHeight, ScrollOrientation scrollOrientation)
440440
{
441441
const string propSetParam = "p";
442-
const string offsetXParam = "offsetX";
442+
const string offsetXParam = nameof(OffsetX);
443443
const string qualifiedOffsetXParam = propSetParam + "." + offsetXParam;
444-
const string offsetYParam = "offsetY";
444+
const string offsetYParam = nameof(OffsetY);
445445
const string qualifiedOffsetYParam = propSetParam + "." + offsetYParam;
446-
const string imageWidthParam = "imageWidth";
446+
const string imageWidthParam = nameof(imageWidth);
447447
const string qualifiedImageWidthParam = propSetParam + "." + imageWidthParam;
448-
const string imageHeightParam = "imageHeight";
448+
const string imageHeightParam = nameof(imageHeight);
449449
const string qualifiedImageHeightParam = propSetParam + "." + imageHeightParam;
450-
const string speedParam = "speed";
450+
const string speedParam = nameof(ParallaxSpeedRatio);
451451

452452
if (_containerVisual == null)
453453
{
@@ -494,6 +494,7 @@ string Thing(string common, string dimension)
494494
// expressions are created to simulate a positive and negative modulo with the size of the image and the offset and the ScrollViewer offset (Translation)
495495
var scrollProperties = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollViewer);
496496
const string scrollParam = "s";
497+
const string translationParam = scrollParam + "." + nameof(scrollViewer.Translation);
497498
const string qualifiedSpeedParam = propSetParam + "." + speedParam;
498499

499500
expressionX.SetReferenceParameter(scrollParam, scrollProperties);
@@ -502,9 +503,9 @@ string Thing(string common, string dimension)
502503
string LocalThing(string scroll, string speed, string offset, string dimension)
503504
=> Thing(string.Format("Ceil(({0} * {1}) + {2})", scroll, speed, offset), dimension);
504505

505-
expressionXVal = LocalThing(scrollParam + ".Translation.X", qualifiedSpeedParam, qualifiedOffsetXParam, qualifiedImageWidthParam);
506+
expressionXVal = LocalThing(translationParam + "." + nameof(scrollViewer.Translation.X), qualifiedSpeedParam, qualifiedOffsetXParam, qualifiedImageWidthParam);
506507

507-
expressionYVal = LocalThing(scrollParam + ".Translation.Y", qualifiedSpeedParam, qualifiedOffsetYParam, qualifiedImageHeightParam);
508+
expressionYVal = LocalThing(translationParam + "." + nameof(scrollViewer.Translation.Y), qualifiedSpeedParam, qualifiedOffsetYParam, qualifiedImageHeightParam);
508509
}
509510

510511
if (scrollOrientation == ScrollOrientation.Horizontal || scrollOrientation == ScrollOrientation.Both)

0 commit comments

Comments
 (0)