Steve Hougom
asked on
how to test code in a wpf user control library
Im trying to figure out how to debug some code I created in a wpf user control library.
Because wpf user control libraries have no startup object Im not sure how to step into my code.
The code is a simple validation of a text box.
I just want some way to invoke it. Maybe a windows form with a button and a text box that references it and calls it.
Because wpf user control libraries have no startup object Im not sure how to step into my code.
The code is a simple validation of a text box.
I just want some way to invoke it. Maybe a windows form with a button and a text box that references it and calls it.
Create a WPF application project, add a reference to your other project and then you will be able to test it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I added a windows form project to mine and Im trying to figure out how to invoke it.
Here is what my solution explorer looks like now.
Im just using a form1 button click to attempt to invoke my validation. Im just not sure how to code the object that allows me to step through my validation.cs in the referenced project.
Here is a button click event that I would like to use invoke the validation class in validation.cs. Im just not sure how to code it.
Here is the validation.cs file in my wpf user control library project.
Here is the xaml from the user control.
<UserControl x:Class="SoftwareAssetForm Validation Control.Va lidationCo ntrol"
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"
mc:Ignorable="d"
Visibility="Collapsed"
Width="Auto" Height="Auto" DataContextChanged="FormCo ntrol_Data ContextCha nged" >
<Grid Height="Auto" Width="Auto">
<TextBox Height="0" Margin="0,0,0,0" Name="textId" VerticalAlignment="Top" Width="0" Text="{Binding Path=$Id$, Mode=OneWay}" Visibility="Collapsed" />
</Grid>
</UserControl>
Here is what my solution explorer looks like now.
Im just using a form1 button click to attempt to invoke my validation. Im just not sure how to code the object that allows me to step through my validation.cs in the referenced project.
Here is a button click event that I would like to use invoke the validation class in validation.cs. Im just not sure how to code it.
Here is the validation.cs file in my wpf user control library project.
Here is the xaml from the user control.
<UserControl x:Class="SoftwareAssetForm
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"
mc:Ignorable="d"
Visibility="Collapsed"
Width="Auto" Height="Auto" DataContextChanged="FormCo
<Grid Height="Auto" Width="Auto">
<TextBox Height="0" Margin="0,0,0,0" Name="textId" VerticalAlignment="Top" Width="0" Text="{Binding Path=$Id$, Mode=OneWay}" Visibility="Collapsed" />
</Grid>
</UserControl>