fbpx

WPF and X# 2.0.0.05

  • George Theopoulos
  • George Theopoulos's Avatar Topic Author
  • Offline
More
2 months 2 weeks ago #1 by George Theopoulos
WPF and X# 2.0.0.05 was created by George Theopoulos
Hi,

one of my WinForm Apps uses WPF Bing Maps V.7 (I wrote a WPF DLL containing the Bing Maps control).

Inside this WPF DLL assembly, one of the components I am using is an 'Infobox' Grid consisted by:
- InfoboxTitle (TextBlock)
- InfoboxDescription (TextBlock)
- CloseInfobox (Button)

some years ago, when I created the assembly, I set the Infobox Background="Black" and the InfoboxTitle and InfoboxDescription Foreground="#1cff1c" ('electric' Green).

Now, I am trying to change the Background and Foreground from my App by changing the 2 Properties sending values to the WPF assembly.

I noticed 2 errors:

1. The compiler conplains at:
PUBLIC CLASS MainVM IMPLEMENTS INotifyPropertyChanged
this Class is used to change the 2 Properties.

By the way, the ILSpy (XSharp) code shows:
public class MainVM implement INotifyPropertyChanged (not implements)
when translates my C# project to X#.

2. The compiler conplains Inside the .XAML at keyword: local:
<Window.DataContext>
<local:MainVM/>
</Window.DataContext>
i.e. when I try to reference this Class inside the .XAML code in order to use it the 2 Properties.

I am attaching 2 projects:

A> a C# named Wpf_PropertyChanged:
it works just fine and I can see the Background, Foreground color changes in XAML Editor.
The problem is I cannot use it because my WPF assembly is Vulcan.NET (X# now) is big (has many components) and I don't want to translate it to C#.

B> a X# named Wpf_XS:
here you can see the 2 errors

Both .XAML files (C# and X#) contain the SAME code.
In the C# one, I have as comments the old: Background="Black", Foreground="#1cff1c"
but in the X#, I have as comments the new (desired) code: Background="{Binding Path=BackgroundColor}", Foreground="{Binding Path=ForegroundColor}".

I know there are experts on WPF in this Group (Nick, Dick, Wolfgang, Philip etc.).

Could you please tell me if the 2 previously mentioned problems are mine errors, or really errors ?

thanks and regards
George
Attachments:

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #2 by Chris Pyrgas
Replied by Chris Pyrgas on topic WPF and X# 2.0.0.05
Hi George,

About the compiler error, this is due to a typo in the code, the event name should be named "PropertyChanged", not "eventPropertyChanged". After you change this, it will compile fine.

About the other issue with the XAML, unfortunately I have no experience in this area to tell, maybe someone else can give some insight. It does appear to be a problem with x# though, since similar XAML works without errors in c#, so I will log this as a bug.

Chrs

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #3 by Nick Friend
Replied by Nick Friend on topic WPF and X# 2.0.0.05
I had a look at the C# and xaml and that seems fine... afraid I haven't actually got X# installed at the moment, but it ought to work I think (especially as George says it works ok in C#).

Nick

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago - 2 months 2 weeks ago #4 by Robert van der Hulst
Replied by Robert van der Hulst on topic WPF and X# 2.0.0.05
George,
Your local definition in the XAML is
xmlns:local="clr-namespace:Wpf_PropertyChanged"

but the namespace in which the class is defined is Wpf_XS
Change the local to

xmlns:local="clr-namespace:Wpf_XS"

and it works as expected

Robert

XSharp Development Team
The Netherlands
This email address is being protected from spambots. You need JavaScript enabled to view it.
Last edit: 2 months 2 weeks ago by Robert van der Hulst. Reason: fixed typo

Please Log in or Create an account to join the conversation.

  • George Theopoulos
  • George Theopoulos's Avatar Topic Author
  • Offline
More
2 months 2 weeks ago #5 by George Theopoulos
Replied by George Theopoulos on topic WPF and X# 2.0.0.05
Thank you Chris, Nick, Robert.

The worst mistakes are the 'copy/paste' ones!

Yes it works now.

Chris, you have to remove the ticket/log for the XAML.

regards
George

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #6 by Chris Pyrgas
Replied by Chris Pyrgas on topic WPF and X# 2.0.0.05

George wrote: Chris, you have to remove the ticket/log for the XAML.


I had not logged it yet, waited a little more, just in case somebody spotted an error in the code :)
So thanks to Robert for that, and also to Nick for stepping in to help!

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.