diff --git a/src/Microsoft.AspNetCore.Blazor/Components/Parameter.cs b/src/Microsoft.AspNetCore.Blazor/Components/Parameter.cs
index 09c806f79f..8e4b9db909 100644
--- a/src/Microsoft.AspNetCore.Blazor/Components/Parameter.cs
+++ b/src/Microsoft.AspNetCore.Blazor/Components/Parameter.cs
@@ -19,10 +19,17 @@ namespace Microsoft.AspNetCore.Blazor.Components
///
public object Value { get; }
- internal Parameter(string name, object value)
+ ///
+ /// Gets a value to indicate whether the parameter is cascading, meaning that it
+ /// was supplied by a .
+ ///
+ public bool Cascading { get; }
+
+ internal Parameter(string name, object value, bool cascading)
{
Name = name;
Value = value;
+ Cascading = cascading;
}
}
}
diff --git a/src/Microsoft.AspNetCore.Blazor/Components/ParameterEnumerator.cs b/src/Microsoft.AspNetCore.Blazor/Components/ParameterEnumerator.cs
index 09806dfa56..9de7197b89 100644
--- a/src/Microsoft.AspNetCore.Blazor/Components/ParameterEnumerator.cs
+++ b/src/Microsoft.AspNetCore.Blazor/Components/ParameterEnumerator.cs
@@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Blazor.Components
_currentIndex = nextIndex;
ref var frame = ref _frames[_currentIndex];
- _current = new Parameter(frame.AttributeName, frame.AttributeValue);
+ _current = new Parameter(frame.AttributeName, frame.AttributeValue, false);
return true;
}
@@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Blazor.Components
_currentIndex = nextIndex;
var state = _cascadingParameters[_currentIndex];
- _current = new Parameter(state.LocalValueName, state.ValueSupplier.CurrentValue);
+ _current = new Parameter(state.LocalValueName, state.ValueSupplier.CurrentValue, true);
return true;
}
else
diff --git a/test/Microsoft.AspNetCore.Blazor.Test/ParameterCollectionTest.cs b/test/Microsoft.AspNetCore.Blazor.Test/ParameterCollectionTest.cs
index 4a7213bf4d..f2def78acc 100644
--- a/test/Microsoft.AspNetCore.Blazor.Test/ParameterCollectionTest.cs
+++ b/test/Microsoft.AspNetCore.Blazor.Test/ParameterCollectionTest.cs
@@ -60,8 +60,8 @@ namespace Microsoft.AspNetCore.Blazor.Test
// Assert
Assert.Collection(ToEnumerable(parameterCollection),
- AssertParameter("attribute 1", attribute1Value),
- AssertParameter("attribute 2", attribute2Value));
+ AssertParameter("attribute 1", attribute1Value, false),
+ AssertParameter("attribute 2", attribute2Value, false));
}
[Fact]
@@ -82,8 +82,8 @@ namespace Microsoft.AspNetCore.Blazor.Test
// Assert
Assert.Collection(ToEnumerable(parameterCollection),
- AssertParameter("attribute 1", attribute1Value),
- AssertParameter("attribute 2", attribute2Value));
+ AssertParameter("attribute 1", attribute1Value, false),
+ AssertParameter("attribute 2", attribute2Value, false));
}
[Fact]
@@ -105,9 +105,9 @@ namespace Microsoft.AspNetCore.Blazor.Test
// Assert
Assert.Collection(ToEnumerable(parameterCollection),
- AssertParameter("attribute 1", attribute1Value),
- AssertParameter("attribute 2", attribute2Value),
- AssertParameter("attribute 3", attribute3Value));
+ AssertParameter("attribute 1", attribute1Value, false),
+ AssertParameter("attribute 2", attribute2Value, true),
+ AssertParameter("attribute 3", attribute3Value, true));
}
[Fact]
@@ -291,12 +291,13 @@ namespace Microsoft.AspNetCore.Blazor.Test
Assert.Same(myEntryValue, result);
}
- private Action AssertParameter(string expectedName, object expectedValue)
+ private Action AssertParameter(string expectedName, object expectedValue, bool expectedIsCascading)
{
return parameter =>
{
Assert.Equal(expectedName, parameter.Name);
Assert.Same(expectedValue, parameter.Value);
+ Assert.Equal(expectedIsCascading, parameter.Cascading);
};
}