I have a Model that contains some data, and a field that can have one of three (enum) values.
Socket,
Tcp,
Udp
And a View that shows some details.
The details that I want shown in the view differ according to the value of this property in the model.
I have read all about ItemTemplates for Lists and Pickers, and I want to do something similar but just with a single view bound to a single property.
If Socket => Show this view
else => Show this other view.
Both views have the same viewmodel.
View
<ContentView.Resources>
<local:SocketServerSocketView x:Key="ServerSocket" />
<local:SocketServerTcpUdpView x:Key="ServerTcpUdp" />
</ContentView.Resources>
...
<ContentView Grid.Column="2" Margin="12" >
<ContentView.Content>
<local:SocketServerTcpUdpView />
</ContentView.Content>
<ContentView.Style>
<Style TargetType="ContentView">
<Style.Triggers>
<DataTrigger TargetType="{x:Type ContentView}" Binding="{Binding Mode}" Value="{Binding models:NetworkMode.Socket}">
<Setter Property="Content" Value="{StaticResource ServerSocket}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentView.Style>
</ContentView>
So I start (by default) displaying the TCP version, and want to dynamically switch it out for the socket template when the value of the enum changes. What am I doing wrong?
