fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: WPF and X# 2.0.0.05

WPF and X# 2.0.0.05 4 months 3 weeks ago #1

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.

WPF and X# 2.0.0.05 4 months 3 weeks ago #2

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.

WPF and X# 2.0.0.05 4 months 3 weeks ago #3

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.

WPF and X# 2.0.0.05 4 months 3 weeks ago #4

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.

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

Last edit: by robert. Reason: fixed typo

WPF and X# 2.0.0.05 4 months 3 weeks ago #5

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.

WPF and X# 2.0.0.05 4 months 2 weeks ago #6

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.

  • Page:
  • 1