Page 2 of 6
Beginners Example
Posted: Wed Jul 07, 2021 3:46 am
by wriedmann
Hi Joe,
I will do that, of course.
WPF is even easier to do (for me) as most of my pure X# programming is done in WPF (and XIDE).
My WPF windows are all done in pure code, and that helps me be more flexible.
Wolfgang
Beginners Example
Posted: Wed Jul 07, 2021 6:32 am
by wriedmann
Hi Joe,
here it is:
It seems even easier than the Windows Forms example.
Wolfgang
Beginners Example
Posted: Wed Jul 07, 2021 7:32 am
by FFF
Very nice, Wolfgang.
Me being a WPF-noob - is there an easy way to change the font used in the datagrid?
Beginners Example
Posted: Wed Jul 07, 2021 7:40 am
by wriedmann
Hi Karl,
really hard <g>:
Code: Select all
_oDataGrid:FontFamily := FontFamily{ "Courier New" }
_oDataGrid:FontSize := 20
Wolfgang
Beginners Example
Posted: Wed Jul 07, 2021 8:25 am
by FFF
Blush...
(But, by way of excuse, i had looked in the api browser, there's no entry regarding font in DataGrid's properties...)
While blushing
, Datagrid has a backround property, but that's only the little rectangles fencing the scrollbar.
Probably, i need oDataGrid:CellStyle := Style{ } ? But i don't get, what/which "type" the style constructor wants...
THX!
Beginners Example
Posted: Wed Jul 07, 2021 8:32 am
by wriedmann
Hi Karl,
unfortunately it is not that easy. This is code from my own class library:
Code: Select all
oHeaderStyle := Style{ TypeOf( System.Windows.Controls.Primitives.DataGridColumnHeader ) }
oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.BackgroundProperty, MVVMControlSettings.DataGridHeaderBackground } )
oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.SeparatorVisibilityProperty, Visibility.Visible } )
oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.SeparatorBrushProperty, MVVMControlSettings.DataGridVerticalGridLinesBrush } )
oHeaderStyle:Setters:Add( Setter{ System.Windows.Controls.Primitives.DataGridColumnHeader.PaddingProperty, MVVMControlSettings.DataGridHeaderPadding } )
self:ColumnHeaderStyle := oHeaderStyle
oCellStyle := Style{ TypeOf( System.Windows.Controls.DataGridCell ) }
oCellStyle:Setters:Add( Setter{ System.Windows.Controls.DataGridCell.PaddingProperty, MVVMControlSettings.DataGridCellPadding } )
self:CellStyle := oCellStyle
Sometimes it is hard to work without XAML.....
Wolfgang
Beginners Example
Posted: Wed Jul 07, 2021 8:54 am
by FFF
Argh...
I think i sort of understand this, so to play further, could you solve "MVVMControlSettings"? Probably a Using missing, but as the apibrowser knows nothing about this term, so what to add?
Beginners Example
Posted: Wed Jul 07, 2021 9:03 am
by wriedmann
Hi Karl,
that is my static settings class - I have copied this code from there.
Code: Select all
MVVMControlSettings.DataGridHeaderPadding := System.Windows.Thickness{ 5, 5, 5, 5 }
MVVMControlSettings.DataGridCellPadding := System.Windows.Thickness{ 6, 6, 6, 6 } // geht aktuell nicht
MVVMControlSettings.DataGridAlternatingRowBackground := System.Windows.Media.SolidColorBrush{ System.Windows.Media.Colors.Gainsboro }
MVVMControlSettings.DataGridVerticalGridLinesBrush := System.Windows.Media.SolidColorBrush{ System.Windows.Media.Color.FromRgb( 170,170,170 ) }
MVVMControlSettings.DataGridHeaderBackground := System.Windows.Media.SolidColorBrush{ System.Windows.Media.Color.FromRgb( 238, 238, 238 ) }
MVVMControlSettings.DataGridRowHeight := 20
These are the defaults for all my applications, but are settable on an application level.
Normally, you use stylesheets for this - that is easier.
But since I don't select always the easiest way, but the way that seems me more flexible, sometimes I have to do strange things.
But nevertheless, for some styles I do add a XAML stylesheet as resource into my WPF applications.
- ServerMan_Ressources.png (5.49 KiB) Viewed 1677 times
Maybe I should publish a full featured WPF application as sample.
Wolfgang
Beginners Example
Posted: Wed Jul 07, 2021 9:20 am
by FFF
Hi Wolfgang,
thx very much, now it works.
Code: Select all
Maybe I should publish a full featured WPF application as sample
That surely would be helpfull - best including access to PG
Beginners Example
Posted: Wed Jul 07, 2021 9:39 am
by wriedmann
Hi Karl,
PostgreSQL access is standard in my newer applications whenever I have the choice:
- ServerMan_Dependencies.png (11.04 KiB) Viewed 1676 times
The main problem is that I have several different libraries in my framework, for different GUI choices (WPF, Windows Forms, Console) and for different database backends (DBF, ADS, Oracle, MS SQL Server, MySQL, PostgreSQL, SQLite), and therefore I have to combine a lot of code into the same application/lib to not to have to share my entire framework.
What you see is one WPF application with only PostgreSQL access, but I have also applications that are accessing 3 or 4 different database backends.
Wolfgang