Problem Fixing a ComboBox in Xaml

Using Microsoft Windows Presentation Foundation and Syncfusion WPF Libraries
Post Reply
User avatar
PGilbert
Posts: 440
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Problem Fixing a ComboBox in Xaml

Post by PGilbert »

If you define a variable called 'xaml' that has the following value:

Code: Select all

<Window
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   Height="350"
   Width="525"
   Title="MainWindow">

   <Grid>
      <ComboBox
         Width="242"
         HorizontalAlignment="Left"
         Margin="129,95,0,0"
         VerticalAlignment="Top"
         IsEditable="True"
         IsReadOnly="True"/>
   </Grid>
</Window>


If you fix doing the following:

Code: Select all

      ⎕USING←'System.Windows.Markup,WPF/PresentationFramework.dll'
      obj←XamlReader.Parse(⊂xaml)


It will work in version 14.1 but in version 15 I am getting the following error:

Code: Select all

EXCEPTION: 'Cannot set unknown member 'System.Windows.Controls.ComboBox.IsReadOnly'.' Line number '16' and line position '10'.


Why is that ?
User avatar
Dick Bowman
Posts: 235
Joined: Thu Jun 18, 2009 4:55 pm
Contact:

Re: Problem Fixing a ComboBox in Xaml

Post by Dick Bowman »

I'm not getting any error (W10 and Dyalog APL/W-64 Version 15.0.28601).

Wondering whether your V14.1 and V15 might be connecting to different versions of Microsoft's .NET morass.
Visit http://apl.dickbowman.com to read more from Dick Bowman
User avatar
PGilbert
Posts: 440
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: Problem Fixing a ComboBox in Xaml

Post by PGilbert »

Thanks for trying and reporting Dick.
Vince|Dyalog
Posts: 439
Joined: Wed Oct 01, 2008 9:39 am

Re: Problem Fixing a ComboBox in Xaml

Post by Vince|Dyalog »

Hi Pierre,

On this computer, does 15.0 work with other XAML WPF code?

Can you send Support the text of your ⎕exception and ⎕exception.InnerException if there is one please?


Your code works for me on Windows 7 and Dyalog 15.0 64-bit Unicode with these assemblies:

obj.Show
]assemblies
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
bridge150-64_unicode, Version=15.0.27698.0, Culture=neutral, PublicKeyToken=eb5ebc232de94dcf
System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
dyalognet, Version=15.0.27698.0, Culture=neutral, PublicKeyToken=eb5ebc232de94dcf
PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
UIAutomationTypes, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
UIAutomationProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
ReachFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

Regards,

Vince
User avatar
PGilbert
Posts: 440
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: Problem Fixing a ComboBox in Xaml

Post by PGilbert »

I have found this post on the web that is similar to my problem. Parsing the following line before parsing the original Xaml is a workaround of the problem that is working for me (as explained in the post). A little bit weird to my taste.

Code: Select all

     inter←'<ComboBox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" IsReadOnly="True"/>'
     ⎕USING←⊂'System.Windows.Markup,WPF/PresentationFramework.dll'
     inter←XamlReader.Parse(⊂inter)
User avatar
JohnD|Dyalog
Posts: 74
Joined: Wed Oct 01, 2008 9:35 am

Re: Problem Fixing a ComboBox in Xaml

Post by JohnD|Dyalog »

Hello Pierre,

We are unable to reproduce the problem here. I've done a little online research, and the consensus seems to be that it’s a Microsoft bug.

Here are a few links that I found (but I suspect you've seen them)

http://stackoverflow.com/questions/6850 ... isreadonly
https://social.msdn.microsoft.com/Forum ... ?forum=wpf
http://connect.microsoft.com/VisualStud ... n-combobox

That last link doesn’t appear to work, but the URL text suggests it *might* be a beta-2 problem. Are you confident that you have an up to date (or at least a non-beta) .Net 4?

Best Regards
John Daintree.
User avatar
PGilbert
Posts: 440
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: Problem Fixing a ComboBox in Xaml

Post by PGilbert »

Hello John, my computer did some 'Windows Update' automatically since I wrote that post and now everything is working fine. I am working on a Window 7 Professional with a .Net version 4.6.2 now.

I agree with you that it is a Microsoft bug, but I still don't understand why the same code was working on my previous v14.1 and not on v15. I am using the following for my 'dyalog.exe.config' file on both version of the interpreter:

Code: Select all

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <!-- <probing privatePath="MJHSoftware;Syncfusion/4.5;Syncfusion"/> -->
      <probing privatePath="C:\Secovac2\Program\Bin\Dll\Syncfusion;C:\Secovac2\Program\Bin\Dll\Secovac"/>
    </assemblyBinding>
    <!-- <NetFx40_LegacySecurityPolicy enabled="true"/> -->
    <loadFromRemoteSources enabled="true"/>
  </runtime>
</configuration>


Is it me that is doing something wrong with my 'dyalog.exe.config' file ?

Thanks,

Pierre Gilbert
Post Reply