Is there a way to assign a property, say, Border, in the ViewModel and have the contents of the border, and then match any typed data pattern matching this VieWModel?
This is a very contrived example, but let me say that I have a usercontrol:
<Grid>
<StackPanel>
<TextBox Height="30" Width="300" Margin="10" Text="{Binding IntProperty}"></TextBox>
<TextBox Height="30" Width="300" Margin="10"></TextBox>
<Border x:Name="SingleElement" Height="100" Width="350" BorderBrush="Red" />
</StackPanel>
</Grid>
And I have this typed data template:
<DataTemplate DataType="local:SingleItemViewModel1">
<StackPanel>
<TextBlock Margin="10" Text="{Binding A}"></TextBlock>
<TextBlock Margin="10" Text="{Binding B}"></TextBlock>
</StackPanel>
</DataTemplate>
Is there a property in the code for my user control (again, far-fetched) SingleElementthat I can assign to a new instance SingleItemViewModel1so that the DataTemplate displayed above appears inside it?
source
share