I have a listbox that I'm binding to a collection of objects.
In the code behind, I get a list of the jobs and bind it to the listbox items source:
List<JobEntity> jobList = new List<JobEntity>();
Job j = new Job();
jobList = j.LoadJobs(pageSize, pageIndex);
lbxJobs.ItemsSource = jobList;
In the xaml, I then try and access some of the properties of the job.
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<TextBlock Text="{Binding Path=Title}" Margin="5 0" />
<TextBlock Text="{Binding Path=HiringCompany}" Margin="5 0" />
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
This works fine for a normal wpf application, but as an xbap app it throws an error that basically says it can't get the value because Reflection Permissions were denied.
System.Windows.Data Error: 16 : Cannot get 'HiringCompany' value (type 'String') from '' (type 'JobEntity'). BindingExpression:Path=HiringCompany; DataItem='JobEntity' (HashCode=64844482); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String') TargetInvocationException:'System.Reflection.TargetInvocationException: Property accessor 'HiringCompany' on object 'JobSearch.Classes.JobEntity' threw the following exception:'JobSearch.Classes.JobEntity.get_HiringCompany()' ---> System.MethodAccessException: JobSearch.Classes.JobEntity.get_HiringCompany() ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed
Has any one run into this before or found a workaround for this error?