views:

257

answers:

1

I'm puzzled. I'm trying to create a user control called TranslationView. It consists pretty much entirely of a single ListView. I don't think that's important now however, because I cannot even compile my code-behind.

This is the code-behind for the user control:

namespace Subster
{

    /// <summary>
    /// Interaction logic for TranslationView.xaml
    /// </summary>
    public partial class TranslationView : UserControl
    {

        // Generated using "propdp" in Visual Studio 2008.
        public ObservableCollection<TransRowOrig> TranslationSource
        {
            get { return (ObservableCollection<TransRowOrig>)GetValue(TranslationSourceProperty); }
            set { SetValue(TranslationSourceProperty, value); }
        }

        // Generated using "propdp" in Visual Studio 2008.
        public static readonly DependencyProperty TranslationSourceProperty =
            DependencyProperty.Register("TranslationSource",
                                        typeof(ObservableCollection<TransRowOrig>),
                                        typeof(TranslationView));

        public TranslationView()
        {
            InitializeComponent();
        }

    }
}   

This is the actual XAML:

<UserControl x:Class="Subster.TranslationView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
    <Grid>
        <ListView Grid.Row="1" ItemsSource="{Binding Path=TranslationSource}">
            <ListView.View>
                <GridView>  
                    <GridView.Columns>
                        <GridViewColumn Header="Start time"/>
                        <GridViewColumn Header="End time"/>
                        <GridViewColumn Header="Duration"/>
                        <GridViewColumn Header="Original"/>
                        <GridViewColumn Header="Translation"/>
                    </GridView.Columns>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>

This is the error I'm getting:

Inconsistent accessibility: property type 'System.Collections.ObjectModel.ObservableCollection' is less accessible than property 'Subster.TranslationView.TranslationSource'.

It makes no sense at all to me, because all of the examples I've found work in similar ways! I don't even use the user control in any other part of the project yet.

Any help highly appreciated!

+3  A: 

Most likely your TransRowOrig object is less accessible then this class which is defined as a public class. So I'd make that TransRowOrig also a public class

Tony
It's so frustratingly simple... Thanks.
Deniz Dogan