CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: Cannot find the type 'local:CompanyViewModel'.

  1. #1
    Join Date
    Nov 2008

    Cannot find the type 'local:CompanyViewModel'.

    I'm having this error while using HierarchicalDataTemplate control

    Error 275 Cannot find the type 'local:CompanyViewModel'. Note that type names are case sensitive. Line 12 Position 35. C:\trunk\Applications\PheonixApp\Controls\LoadOnDemandControl\LoadOnDemandControl.xaml 12 35 PheonixApp

    The CompanyViewModel class has been made to public and inherits from TreeViewItemViewModel.

    Can anyone help me out with this error? thanks

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Cannot find the type 'local:CompanyViewModel'.

    You need to define the namespace called 'local'.

    For example, the namespace named 'local' below is defined as Iridyn.Facilitator:

    <UserControl x:Class="Iridyn.Facilitator.Controls.ScheduleExplorerControl"
    VerticalAlignment="Stretch" >
    <HierarchicalDataTemplate DataType="{x:Type local:ExplorerNode}"
    ItemsSource="{Binding Path=ChildNodes}">

  3. #3
    Join Date
    Jun 2010

    Re: Cannot find the type 'local:CompanyViewModel'.

    been going over some sample examples from C# unleashed, and i've been stuck on this problem for awhile now. from the following code

    <Window x:Class="chapter26_A.Window1"
    Title="Window1" Height="300" Width="300">

    <!--<Style x:Key="labelStyle" TargetType="{x:Type Label}">
    <Setter Property="BorderThickness" Value="10" />
    <Setter Property="BorderBrush" Value="Black" />
    <ObjectDataProvider x:Key="hospitalDataSource"
    ObjectType="{x:Type local:HospitalManager}"

    get the following errors

    C:\Users\markdesk\Documents\practice_c#\chapter26_A\chapter26_A\Window1.xaml(14,29): error MC3050: Cannot find the type 'local:HospitalManager'. Note that type names are case sensitive. Line 14 Position 29.
    Done building project "chapter26_A.csproj" -- FAILED.
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    i call teh function gethospitalstaff here

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.Windows.Xps.Packaging;
    using System.IO;

    namespace chapter26_A
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public class HospitalManager
    public List<HospitalStaff> GetHospitalStaff()
    return new HospitalDataContext()
    public partial class Window1 : Window
    public Window1()
    //dvAppDesign.Loaded +=
    //(sender, args) =>
    // dvAppDesign.Document =
    // new XpsDocument(
    // "myFile.xps",FileAccess.Read).GetFixedDocumentSequence();
    private void Window_Loaded(object sender, RoutedEventArgs e)


    would appreciate any help, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)