WPF application, using Prism.
I am using a multi phase module initialiser and in the initialisation of the module I would like the module to self inspect the views and register any regions defined within.
I am using something similar to the code below to self inspect view model classes and register other things, but I have no idea how to reflect into a view.
protected void SelfInspectRegions()
{
var assm = Assembly.GetAssembly(this.GetType()).GetTypes();
foreach (var type in assm)
{
if(type.IsSubclassOf(typeof(UserControl)))
{
var a = type;
}
}
}
An example of a Tab based region (defined on a View/UserControl) I would like to self register is below;
<controls:ChTabControlModelAware x:Name="OrderProcessingDocumentDetailRegion"
cal:RegionManager.RegionManager="{Binding RegionManager, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type shells:FormShell}}}"
cal:RegionManager.RegionName="Order Processing:DocumentDetailRegion"
cal:RegionManager.RegionContext="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"
Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="1" VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<bindings:EventToCommandBehavior.EventBindings>
<bindings:EventBinding Command="{Binding SelectedDetailTabChangedCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=controls:TabControl}, Path= SelectedItem.DataContext.HeaderInfo}"
EventName="SelectionChanged" RaiseOnHandledEvents="True"
PassEventArgsToCommand="True" />
</bindings:EventToCommandBehavior.EventBindings>
</controls:ChTabControlModelAware>
Principally I would like to extract the RegionName defined in the line;
cal:RegionManager.RegionName="Order Processing:DocumentDetailRegion"
I am not sure how to do this and any help would be gratefully received
Many Thanks
Lance
Aucun commentaire:
Enregistrer un commentaire