WinBatch Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: stanl on May 08, 2014, 01:12:52 pm

Title: More on CLR and WPF in WB
Post by: stanl on May 08, 2014, 01:12:52 pm
I attached a simple mod to Deana's script (from the last thread). Now comes the question. It appears that WPF can be implemented  through 'associating' the correct presentation dlls to some C# code, then creating an xaml file that references the class used in the C# code.  For example, to house a grid
Code: [Select]
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wpg="clr-namespace:WPG;assembly=WPG"
        Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
    <Grid>
        <wpg:PropertyGrid AutomaticlyExpandObjects="False"  Width="320" Foreground="BlanchedAlmond" Instance="{Binding ElementName=myGrid}" x:Name="wpgMyControl" ShowDescription="False" ShowPreview="false"  />
    </Grid>
</Window>


So, thought I would ask: Can the 'associations' be accomplished with WB, so that xaml (like above) can be loaded, then associated with C# to populate a grid (from the WPF grid class).

I anticipate....

NO

YES but not in current WB version

YES but so what; grid would display only

READ THIS BOOK.


Be kind. After 41 years of marriage, taking my first class tonight to learn how to dance with my wife, as we plan to surprise our daughter by dancing to "Wagon Wheel" (Old Crow Medicine Show) at her wedding this fall.
Title: Re: More on CLR and WPF in WB
Post by: Deana on May 08, 2014, 03:20:39 pm
It appears that XAML expects a custom assembly named WPG

Code: Winbatch
xmlns:wpg="clr-namespace:WPG;assembly=WPG"
 

Reference: http://msdn.microsoft.com/en-us/library/ms752059(v=vs.110).aspx

Not exactly sure how to reference the assembly from your WinBatch script. I would probably start with trying something like:

Code: Winbatch
ObjectClrOption('appbase','C:\{SOMEPATH}\')
ObjectClrOption("use","WPG")
 

No idea if that would even work....Maybe someone with more familiarity of XAML and custom classes will chime in.
Title: Re: More on CLR and WPF in WB
Post by: Deana on May 09, 2014, 01:14:40 pm
Here is a DataGridView Sample using pure WinBatch: http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/dotNet/System_Windows/System_Window_Forms+DataGridView.txt