I am deserializing a XML file into a class and then trying to display some XAML (stored in a property in the class) in a ContentControl.
Here is my XML:
<CallSteps>
<CallStep>
<StepID>20</StepID>
<StepName>Intro</StepName>
<StepXaml>
<![CDATA[<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:uc="clr-namespace:CallTracker.Library.UserControls.BaseUserControls;assembly=CallTracker.Library">
<uc:LabelValueControl Label="TestLabel" Value="356733" />
</StackPanel>]]>
</StepXaml>
</CallStep>
<CallStep>
<StepID>30</StepID>
<StepName>Intro</StepName>
<StepXaml>
<![CDATA[<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:uc="clr-namespace:CallTracker.Library.UserControls.BaseUserControls;assembly=CallTracker.Library">
<uc:LabelValueControl Label="TestLabel2" Value="356738124315" />
</StackPanel>]]>
</StepXaml>
</CallStep>
</CallSteps>
This correctly deserializes to a collection of CallStep
objects. Here is what a single CallStep
object looks like:
As part of my code I have a CurrentCallStep
which contains a single CallStep
. I would like to display the XAML contained in StepXaml
within a ContentControl
(or some other container) using something like:
in VM:
/// <summary>
/// Current call step object
/// </summary>
public CallStep CurrentCallStep
{
get { return _CurrentCallStep; }
set
{
_CurrentCallStep = value;
NotifyPropertyChanged(m => m.CurrentCallStep);
}
}
private CallStep _CurrentCallStep;
in View:
<!-- CurrentCallStep contains the XAML for the current call steps to be displayed -->
<ContentControl Content="{Binding CurrentCallStep.StepXaml}"
Background="LightBlue"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
This however is not converting the XAML to XAML but rather just showing the text like:
How can I get the text in CurrentCallStep.StepXaml
to convert to XAML?