Answer the question
In order to leave comments, you need to log in
How to display data in xaml constructor?
In VS, the xaml designer has such a feature that allows you to display some data in the designer without compiling the application, I managed to google only the old Silverlight material and it didn’t take off for me. Here's how I do it:
<UserControl.Resources>
<x:DummyList x:Key="DummyData"/>
<CollectionViewSource x:Name="Dummys" Source="{StaticResource DummyData}"/>
</UserControl.Resources>
...
<ListBox Grid.Row="1" ItemsSource="{Binding}" Style="{StaticResource JagermasterListbox}" d:DataContext="{Binding}">
...
namespace TargetList
{
public sealed partial class TargetsListManage : UserControl
{
public class DummyList : List<TargetsListItem>
{
public DummyList()
{
AddRange(TargetsModel.DefaultTargets);
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Everything, I understood correctly.
public class DummyList : List<TargetsListItem>
{
public DummyList()
{
AddRange(TargetsModel.DefaultTargets);
}
}
"DummyList" is nested in "TargetsListManage" => worth using its fully qualified name == "TargetsListManage.DummyList"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question