Explorar o código

avalonia: Did styling stuff for DateSelectoButton

Kenric Nugteren hai 2 meses
pai
achega
fa8b718448

+ 1 - 0
PRS.Avalonia/PRS.Avalonia/App.axaml

@@ -19,6 +19,7 @@
 
 		<StyleInclude Source="avares://AvaloniaProgressRing/Styles/ProgressRing.xaml"/>
 		<StyleInclude Source="avares://PRS.Avalonia/Theme/ProgressRing.axaml"/>
+		<StyleInclude Source="avares://PRS.Avalonia/Theme/FormControlStyles.axaml"/>
 
 		<dialogHostAvalonia:DialogHostStyles/>
 

+ 5 - 0
PRS.Avalonia/PRS.Avalonia/Components/FormsEditor/Controls/IDigitalFormControl.cs

@@ -10,6 +10,11 @@ namespace PRS.Avalonia.DigitalForms;
 
 public abstract class DigitalFormControl : ContentControl
 {
+    public DigitalFormControl()
+    {
+        Classes.Add("DFFieldControl");
+    }
+
     public DigitalFormViewer FormViewer { get; set; }
 
     protected abstract Control Create();

+ 4 - 0
PRS.Avalonia/PRS.Avalonia/Components/FormsEditor/DigitalFormViewer.axaml.cs

@@ -240,6 +240,10 @@ public partial class DigitalFormViewer : UserControl, IDFRenderer
         {
             control.FormViewer = this;
             control.SetControl(item);
+            if(control is IDigitalFormField fieldControl && item is DFLayoutField field)
+            {
+                fieldControl.SetBackground(GetItemBackgroundBrush(field));
+            }
         }
         return control;
     }

+ 11 - 0
PRS.Avalonia/PRS.Avalonia/Theme/FormControlStyles.axaml

@@ -0,0 +1,11 @@
+<Styles xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+		xmlns:components="using:InABox.Avalonia.Components"
+		xmlns:forms="using:PRS.Avalonia.DigitalForms">
+	<Style Selector=":is(forms|DigitalFormControl).DFFieldControl components|DateSelectorButton">
+        <Setter Property="BorderBrush" Value="{DynamicResource PrsButtonBorder}" />
+        <Setter Property="BorderThickness" Value="{DynamicResource PrsBorderThickness}"/>
+        <Setter Property="Foreground" Value="{DynamicResource PrsButtonForeground}" />
+        <Setter Property="CornerRadius" Value="{DynamicResource PrsCornerRadius}" />
+	</Style>
+</Styles>