While I was trying to find a solution to a previous problem I asked about in this forum regarding
loading a secondary view dynamically
in a view with Primary-Secondary layout, I came across two issues that I think should be fixed or improved.
- In the
Controller class and inside the
Execute method, there is a check for the type of parameters on the controller instance method in order to know which method to invoke:
if (routedParameters.ContainsKey(expectedParameterName) &&
expectedParameter.ParameterType == routedParameters[expectedParameterName])
especially the line
expectedParameter.ParameterType == routedParameters[expectedParameterName]
, shouldn't this use
instead of strict comparison as this prevents someone from sending a subclass of an abstract base class or an implementation of an interface ?
- Looking at the source code of
PartialView.cs I found out that the
View property is registered as dependency property with a different name, that is
DependencyProperty ViewProperty = DependencyProperty.Register("Document" ...
This prevents someone from binding to the view property using the binding markup, because there is no dependency property defined on partial view with name
, Why ?
This caused me a couple of problems, so I am considering modifying the source code and I have two questions:
- Is modifying the name of the registered property to
View instead of
Document and checking for subtype might cause problems in other areas of the application ?
- Is this intentional by the framework authors, What's the point ?
Thank you so much for taking the time to read all of the questions and taking the time to answer thoroughly, I appreciate that.