I am using GoXam Palette and diagram controls in my WPF application, which is using Prism and Mvvm frameworks.
in my control for toolbox window, i want to show multiple palettes in a listbox/ItemsControl, and i am binding Palette.Model in Xaml, as shown below
Xaml :
<ListBox x:Name="itemsControl" ItemsSource="{Binding Path=Categories}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel DataContext="{Binding}" Orientation="Vertical">
<TextBlock Text="{Binding Path=Name}" />
<go:Palette Height="200"
Padding="10" BorderBrush="Gray" BorderThickness="1"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Top"
NodeTemplate="{StaticResource MyNodeTemplate}"
Model="{Binding Path=PaletteModel}">
<go:Diagram.Layout>
<go:GridLayout Sorting="Forward" CellSize="5 5" />
</go:Diagram.Layout>
</go:Palette>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Model:
public class ToolBoxViewModel :BindableBase
{
public ObservableCollection<CategoryPaletteModel> Categories { get; set; }
.
.
.
.
.
}
public class CategoryPaletteModel : BindableBase
{
private string _Name;
public string Name {
get {
return _Name;
}
set
{
SetProperty(ref this._Name, value);
}
}
private GraphLinksModel<MyNodeData, string, string, MyLinkData> _PaletteModel;
public GraphLinksModel<MyNodeData, string, string, MyLinkData> PaletteModel
{
get
{
return _PaletteModel;
}
set
{
SetProperty(ref _PaletteModel, value);
}
}
}
it is executing, and showing multiple Palettes in a list, but the problem is it is not showing nodes in it. although all node items are correctly being populated into the Categories[n].PaletteModel
The strange thing is when i bring Palette control out of ListBox/ItemsControl, and showing only one Palette, it is showing all nodes into the palette.
Please help me in fixing this issue.