Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Abstract functionality of a window in WPF

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
I seem unable to derive a window from my own abstract class that derives from window.

My code worked great when I was using Windows Forms, I was told I should start using WPF and now I can't get it to work?

ProgressForm - Abstract class
Code:
namespace HLP_Class_Library
{
    public abstract class ProgressForm : Window
    {
        public abstract void AddMessage(string msg);
        public abstract void ClearMessage();
    }
}

Progress_Info - Concrete window class derived from ProgressForm
Code:
namespace HLP_Class_Library
{
    /// <summary>
    /// Interaction logic for Progress_Info.xaml
    /// </summary>
    public partial class Progress_Info : ProgressForm
    {
        public Progress_Info()
        {
            InitializeComponent();
        }

        // add messages to form
        public override void AddMessage(string msg)
        {
            if (msg != null && msg != "")
            {
                this.Progress.AppendText(msg);
            }
        }

        // clear form messages
        public override void ClearMessage()
        {
            this.Progress.Document.Blocks.Clear();
        }
    }
}

Progress_Info XAML
Code:
<src:ProgressForm 
        x:Class="HLP_Class_Library.Progress_Info"
        xmlns="[URL unfurl="true"]http://schemas.microsoft.com/winfx/2006/xaml/presentation"[/URL]
        xmlns:x="[URL unfurl="true"]http://schemas.microsoft.com/winfx/2006/xaml"[/URL]
        xmlns:src="clr-namespace:HLP_Class_Library"
        Title="Progress_Info" Height="300" Width="300">
    <Grid>
        <RichTextBox x:Name="Progress" HorizontalAlignment="Left" Height="270" VerticalAlignment="Top" Width="292">
            <FlowDocument>
                <Paragraph>
                    <Run Text="RichTextBox"/>
                </Paragraph>
            </FlowDocument>
        </RichTextBox>

    </Grid>
</src:ProgressForm>

Error
The name "ProgressForm" does not exist in the namespace "clr-namespace:HLP_Class_Library".

Yes it does, intelisense even provided me the option?

What am I doing wrong? This was easy in WinForm, I'm clearly missing something obvious in WPF.

Thanks,
1DMF


"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
It's OK, what I have seems to be correct, it was another error causing an assembly to not compile and therefore couldn't see the class!

This WPF/XAML is going to take a little getting used to!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top