Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i give this error :
HTML
Error	1	'NezamMohandesi.WindowManager' does not contain a definition for 'CloseButton_Click' and no extension method 'CloseButton_Click' accepting a first argument of type 'NezamMohandesi.WindowManager' could be found (are you missing a using directive or an assembly reference?)	D:\Project\WPFNezamMohandesi\NezamMohandesi\NezamMohandesi\WindowsStyles.xaml	45	108	NezamMohandesi


my resource code:
HTML
<Button x:Name="Close" Content="Button" Width="27" Margin="2,2,0,2" Style="{DynamicResource ButtonClose}" Click="CloseButton_Click" />


C#
public class WindowsManager : ResourceDictionary
   {
       public WindowsManager()
       {
           // Insert code required on object creation below this point.
       }

       public void CloseButton_Click(object sender, EventArgs e)
       {
           Window window = ((FrameworkElement)sender).TemplatedParent as Window;
           if (window != null)
               window.Close();

       }
   }


complet Source :
My Source File
Posted

1 solution

The error says this:
'NezamMohandesi.WindowManager' does not contain a definition for 'CloseButton_Click'

It mentions WindowManager, but the class in your code block is called WindowsManager (with an s between Window and Manager). You'll have to rename your class WindowsManager to WindowManager, or making sure that your XAML code refers to WindowsManager.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900