Hi all,
I'm having an issue where I can't get an object to bind to my backstage view. I've used the code from the website to try and implement a recent file list from a class within another project.
A cut-down version of my BackstageViewModel to demonstrate what I'm calling:
The RecentFileList class is a class from the WpfApplicationFramework library. You can obtain the library here. In summary, it's a holder class for a ReadOnlyObservableCollection of RecentFile called RecentFiles.
This is the portion of the code where I'm creating my items control in my backstage where ssm points to the project namespace.
All I need to do is have the ItemsControl populate using the ReadOnlyObservableCollection<RecentFile> from within the RecentFileList object. I'm struggling to get it to bind correctly so any help would be greatly appreciated!
I'm having an issue where I can't get an object to bind to my backstage view. I've used the code from the website to try and implement a recent file list from a class within another project.
A cut-down version of my BackstageViewModel to demonstrate what I'm calling:
public
class
BackstageViewModel : IViewModel {
public
RecentFileList RecentFiles {
get
;
set
; }
// the property I want to point to
public
BackstageViewModel(ApplicationCommandProxy commandProxy, DataHolder data)
{
//random setup stuff
}
//and so on...
}
The RecentFileList class is a class from the WpfApplicationFramework library. You can obtain the library here. In summary, it's a holder class for a ReadOnlyObservableCollection of RecentFile called RecentFiles.
This is the portion of the code where I'm creating my items control in my backstage where ssm points to the project namespace.
<
ItemsControl
Name
=
"RecentItem"
DataContext
=
"{Binding ssm:BackstageViewModel}"
ItemsSource
=
"{Binding RecentFiles.RecentFiles}"
Focusable
=
"True"
DisplayMemberPath
=
"RecentFiles"
>
<
ItemsControl.Template
>
<
ControlTemplate
>
<
telerik:RadRibbonButton
Width
=
"285"
Command
=
"{x:Static commands:ApplicationCommands.RecentDocumentCommand}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Source
=
"Resources/Open_16.png"
/>
<
StackPanel
Margin
=
"3 0 0 0"
HorizontalAlignment
=
"Left"
>
<
TextBlock
Margin
=
"0 0 0 2"
Text
=
"Example Study"
/>
<
TextBlock
Foreground
=
"DimGray"
Text
=
"{Binding Path}"
/>
</
StackPanel
>
</
StackPanel
>
</
telerik:RadRibbonButton
>
</
ControlTemplate
>
</
ItemsControl.Template
>
</
ItemsControl
>
All I need to do is have the ItemsControl populate using the ReadOnlyObservableCollection<RecentFile> from within the RecentFileList object. I'm struggling to get it to bind correctly so any help would be greatly appreciated!