Skip to content

Commit

Permalink
Update samples to use background instead of backgroundColor
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLariviere committed Sep 16, 2022
1 parent 7db50f2 commit 24bff30
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ module AboutPage =
ScrollView(
(VStack() {
ContentView(Image(Aspect.AspectFit, "icon.png"))
.backgroundColor(accentColor)
.background(accentColor)
.size(height = 100., width = 100.)
.centerHorizontal()
.padding(15.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module Components =

let destroyButton text onClicked =
Button(text, onClicked)
.backgroundColor(Color.Red.ToFabColor())
.background(Color.Red.ToFabColor())
.textColor(Color.White.ToFabColor())
.margin(0., 20., 0., 0.)
.alignEndVertical(expand = true)
Expand All @@ -55,7 +55,7 @@ module Components =
.verticalTextAlignment(TextAlignment.Center)
.margin(Thickness(20., 5.))
})
.backgroundColor(accentColor)
.background(accentColor)
)

let cellView picture name address isFavorite =
Expand Down Expand Up @@ -90,7 +90,7 @@ module Components =

let detailActionButton (imagePath: string) onClicked =
ImageButton(Aspect.AspectFit, imagePath, onClicked)
.backgroundColor(accentColor)
.background(accentColor)
.size(height = 35.)
.fillHorizontal(expand = true)

Expand Down Expand Up @@ -121,7 +121,7 @@ module Components =
match picture with
| None ->
ContentView(ImageButton(Aspect.AspectFit, "addphoto.png", updatePicture))
.backgroundColor(Color.White.ToFabColor())
.background(Color.White.ToFabColor())
.gridRowSpan(2)

| Some picture ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module ContactsListPage =
title,
(VStack(spacing = 0.) {
SearchBar(model.FilterText, UpdateFilterText, Search)
.backgroundColor(accentColor)
.background(accentColor)
.cancelButtonColor(accentTextColor)

(ListView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ module DetailPage =
.alignStartVertical()
})
.size(height = 125., width = 125.)
.backgroundColor(Color.White.ToFabColor())
.background(Color.White.ToFabColor())
.centerHorizontal()

(HStack(spacing = 20.) {
Expand All @@ -133,7 +133,7 @@ module DetailPage =
.centerHorizontal()
.margin(0., 10., 0., 10.)
})
.backgroundColor(FabColor.fromHex "#448cb8")
.background(FabColor.fromHex "#448cb8")
.padding(20., 10., 20., 10.)
with
| ex -> raise ex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module CityView =
}
)
)
.backgroundColor(Styles.HourlyForecastStartColor)
.background(Styles.HourlyForecastStartColor)
})
.centerHorizontal()
.margin(0., 30., 0., 0.)
Expand Down
4 changes: 2 additions & 2 deletions samples/Xamarin.Forms/TicTacToe/TicTacToe/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ module App =
for row, col as pos in positions do
if canPlay model model.Board.[pos] then
Button("", Play pos)
.backgroundColor(Colors.lightBlue)
.background(Colors.lightBlue)
.gridRow(row * 2)
.gridColumn(col * 2)
else
Expand All @@ -252,7 +252,7 @@ module App =

Button("Restart game", Restart)
.textColor(Colors.black)
.backgroundColor(Colors.lightBlue)
.background(Colors.lightBlue)
.font(namedSize = NamedSize.Large)
.gridRow(2)
}
Expand Down
2 changes: 1 addition & 1 deletion src/Fabulous.XamarinForms/Views/_VisualElement.fs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ type VisualElementModifiers =
/// <summary>Sets the background color depending if light or dark mode.</summary>
[<Extension; Obsolete("Use background instead.")>]
static member inline backgroundColor(this: WidgetBuilder<'msg, #IVisualElement>, light: FabColor, ?dark: FabColor) =
this.background(light, ?dark = dark)
this.AddScalar(VisualElement.BackgroundColor.WithValue(AppTheme.create light dark))

/// <summary>Sets the background color depending if light or dark mode.</summary>
[<Extension>]
Expand Down

0 comments on commit 24bff30

Please sign in to comment.