Well I got this error right after I changed something, but I can't remember what, and even after noticing this thing I UNDOed everything I have done before the error, and still - no answer.
I'm working on a project witch uses an element host. The elementHost should connect to my Usercontroll, witch looks like this:
<usercontrol>
x:Class="CustomCalendar.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CustomCalendar"
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
xmlns:primitives="clr-namespace:Microsoft.Windows.Controls.Primitives;assembly=WPFToolkit"
xmlns:vsm="clr-namespace:System.Windows;assembly=WPFToolkit"
Width="500"
Height="400" FlowDirection="RightToLeft">
<grid>
<local:monthviewcalendar xmlns:local="#unknown" />
</grid>
</usercontrol>
The "MonthViewCalendar" is only a class, without any xaml files in it, and the code of this class is:
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.Drawing;
using System.Data;
using Microsoft.Windows.Controls;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
namespace CustomCalendar
{
public class MonthViewCalendar : Calendar, INotifyPropertyChanged
{
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
public static DependencyProperty AppointmentsProperty =
DependencyProperty.Register
(
"Appointments",
typeof(ObservableCollection<appointment>),
typeof(Calendar)
);
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
private const int MOUSEEVENTF_RIGHTUP = 0x10;
private bool addingApp = false;
bool HiddingForm = false;
public ObservableCollection<appointment> Appointments
{
get { return (ObservableCollection<appointment>)GetValue(AppointmentsProperty); }
set { SetValue(AppointmentsProperty, value); }
}
static MonthViewCalendar()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MonthViewCalendar), new FrameworkPropertyMetadata(typeof(MonthViewCalendar)));
}
public MonthViewCalendar()
: base()
{
if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
{
}
}
protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
{
base.OnMouseDoubleClick(e);
if (addingApp == true)
{
FrameworkElement element = e.OriginalSource as FrameworkElement;
if (element.DataContext is DateTime)
{
AppointmentWindow appointmentWindow = new AppointmentWindow
(
(Appointment appointment) =>
{
Appointments.Add(appointment);
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("Appointments"));
}
}
);
appointmentWindow.Show();
}
}
else
{
if (this.SelectedDate != null)
{
}
}
}
static public System.Drawing.Font BoldFont(System.Drawing.Font font, string result)
{
if (font != null)
{
System.Drawing.FontStyle fontStyle = font.Style;
if (result == "bold")
{
if ((fontStyle & System.Drawing.FontStyle.Bold) == 0)
{
fontStyle |= System.Drawing.FontStyle.Bold;
font = new Font(font, fontStyle);
}
}
else if (result == "underline")
{
if ((fontStyle & System.Drawing.FontStyle.Underline) == 0)
{
fontStyle |= System.Drawing.FontStyle.Underline;
font = new Font(font, fontStyle);
}
}
else if (result == "italic")
{
if ((fontStyle & System.Drawing.FontStyle.Italic) == 0)
{
fontStyle |= System.Drawing.FontStyle.Italic;
font = new Font(font, fontStyle);
}
}
else if (result == "strikeout")
{
if ((fontStyle & System.Drawing.FontStyle.Strikeout) == 0)
{
fontStyle |= System.Drawing.FontStyle.Strikeout;
font = new Font(font, fontStyle);
}
}
else if (result == "regular")
{
if ((fontStyle & System.Drawing.FontStyle.Regular) == 0)
{
fontStyle |= System.Drawing.FontStyle.Regular;
font = new Font(font, fontStyle);
}
}
}
return font;
}
private void MenuItemClickHandlerEdit(object sender, EventArgs e)
{
/
}
EditAppointmentWindow editappointmentWindow = new EditAppointmentWindow
(
(Appointment appointment) =>
{
Appointments.Add(appointment);
Event_ReloadEvents();
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("Appointments"));
Event_ReloadEvents();
}
}
,title,type,date,time,dhifut,assignedto,discription,EventId);
editappointmentWindow.Show();
editappointmentWindow.Focus();
}
private void MenuItemClickHandlerShow(object sender, EventArgs e)
{
System.Windows.Forms.ToolStripMenuItem clickedItem = (System.Windows.Forms.ToolStripMenuItem)sender;
MessageBox.Show("Show eventID: " + clickedItem.Tag.ToString());
}
private void MenuItemClickHandlerDelete(object sender, EventArgs e)
{
}
private void MenuClickHandlerDeleteAll(object sender, EventArgs e)
{
System.Windows.Forms.ToolStripMenuItem clickedItem = (System.Windows.Forms.ToolStripMenuItem)sender;
Event_DeleteAllEvents();
}
public void Event_ReloadEvents()
{
System.Windows.Forms.Form tF = new System.Windows.Forms.Form();
foreach (System.Windows.Forms.Form S in System.Windows.Forms.Application.OpenForms)
{
if (S is Form1)
{
tF = S;
S.Hide();
HiddingForm = true;
}
}
if (HiddingForm == true)
{
new Form1().Show();
}
}
public void Event_DeleteAllEvents()
{
DateTime d = ConvertDateExtoDate(this.SelectedDate.ToString());
}
public void Event_CreateNewAppointment()
{
}
}
}
</appointment></appointment></appointment>
If I goes to the design view, it trows me the error I mentioned, and selects the line <local:monthviewcalendar xmlns:local="#unknown">.
I can't compile the application and can't set the child of the element host to my UserControll.
I even tried to uncomment all the lines witch I wrote "code here" or "something goes here", witch were extremely long and I thought it has something to do with it, but still - no answer for me.
Anyone knows whats the big deal?
Hope for a quick answer,
Tom
[Modifed: switched the triple backslashes to doubles because it was screwing up the colors]