I'm writing tests using WiPFlash for a WPF application that has been developed in our office. In order to do this I have had to add name attributes to several of WPF components that up until now have not needed them.
I have hit a block though in trying to set unique names to a set of objects that are created at runtime. The XAML looks like:
<UserControl x:Class="Atlas.Activities.RibbonActivity.RibbonActivityView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
xmlns:RoutedMessaging="clr-namespace:Caliburn.PresentationFramework.RoutedMessaging;assembly=Caliburn.PresentationFramework" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
<ribbon:RibbonButton Style="{StaticResource RibbonButtonView}" Name="RibbonActivity">
<ribbon:RibbonButton.ContextMenu>
<ribbon:RibbonContextMenu>
<ribbon:RibbonMenuItem x:Name="Modify" Header="Modify..." RoutedMessaging:Message.Attach="[Event Click] = [Action Modify]" />
<ribbon:RibbonMenuItem x:Name="Hide" Header="Hide" RoutedMessaging:Message.Attach="[Event Click] = [Action Hide]" />
<ribbon:RibbonMenuItem x:Name="Delete" Header="Delete" RoutedMessaging:Message.Attach="[Event Click] = [Action Delete]" />
</ribbon:RibbonContextMenu>
</ribbon:RibbonButton.ContextMenu>
</ribbon:RibbonButton>
The constructor set the subject using:
WithSubject(activity);
which is inhereted from Caliburn.PresentationFramework.Screens.
So what I want to do is set the name of each control to be the name field within the subject (activity).
Can anyone help me out, or at least let me know if this is possible,
Thanks in advance,
Klee.