Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

SharpDevelop 5.1 AddIn - Error: 4

$
0
0

,

I want to start with the AddIns for SharpDevelop. I want to make the editor/tool for the files in the project/project-tree and I want to edit the file by the SharpDevelop (not extern app). I found some examlpes, but by start the SD, in OUTPUT is:

Starting SharpDevelop...
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'CoreMenuItem' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'CoreMenuItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')
...

.....................many times

 

=> The addin works not.

Thx for every help.

My code:

<AddIn name        ="SD_Alarms"
       author      ="XXX"
       url         =""
       description="TODO: Put description here">
    
    <Manifest> 
        <Identity name="TestAddIn.Test"version="@TestAddIn.dll"/> 
         <Dependency addin="SharpDevelop"version="5.1"/> 
    </Manifest>
    
    <Runtime>
        <Import assembly="SD_Alarms.dll"/>
    </Runtime>
    
    <Path name="/SharpDevelop/Workbench/FileFilter">
        <FileFilter id="AlarmListFileFilter"
                    name="Alarms"
                    extensions="*.alms;" />
    </Path>
    
    <Path name="/SharpDevelop/Workbench/DisplayBindings">
        <DisplayBinding id="AlarmsEditor"
                        class="SD_Alarms.AlarmsEditorDisplayBinding"
                        insertbefore="Text"
                        fileNamePattern=".\(alms)$" />
    </Path>
</AddIn>

 

using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;

namespace SD_Alarms
{
    
    publicclassAlarmsEditorDisplayBinding : IDisplayBinding
    {
        publicboolIsPreferredBindingForFile(FileName fileName)
        {
            returntrue;
        }
        publicboolCanCreateContentForFile(FileName fileName)
        {
            returntrue;
        }
        publicdoubleAutoDetectFileContent(FileName fileName, Stream fileContent, string detectedMimeType)
        {
            returndouble.NegativeInfinity;
        }
        
        publicIViewContentCreateContentForFile(OpenedFile file)
        {
            var aec = newAlarmEditorContent();
            
            return aec;
        }
    }
}

 

 

 

using System;
using System.IO;
using System.Reflection;
using System.Globalization;
using System.Collections.ObjectModel;
using System.Threading;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Text.RegularExpressions;

using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;

namespace SD_Alarms
{
    publicclassAlarmEditorContent : AbstractViewContent
    {
        //DataGridView gridView = new DataGridView();
        Labelxxxlabel = newLabel();
        
        publicAlarmEditorContent()
        {
            xxxlabel.Dock = DockStyle.Fill;
            xxxlabel.Text = "fooooooo";
        }
        
        publicoverrideobject Control {
            get {
                returnxxxlabel;
            }
        }
        
        publicoverridevoidLoad(OpenedFile file, Stream stream)
        {
            //base.Load(file, stream);
            
            this.TitleName = Path.GetFileName(file.FileName);
            
//            this.gridView.Columns.Add("XXX","XXX_H");
//            this.gridView.Rows.Add("A0","B0","C0");
            
        }
        
        publicoverridevoidSave(OpenedFile file, Stream stream)
        {
            //base.Save(file, stream);
            MessageBox.Show("Saving...");
        }
        
    }
}

 

 


Viewing all articles
Browse latest Browse all 1764

Trending Articles