Skip to content

Commit

Permalink
Merge pull request #107 from DamianSuess/patch-1
Browse files Browse the repository at this point in the history
Update upgrade-from-0.10.md
  • Loading branch information
maxkatz6 authored Jul 21, 2023
2 parents 5751936 + 47cfd38 commit 12bf7ff
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/stay-up-to-date/upgrade-from-0.10.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,21 @@ The `FluentTheme` tag no longer requires the `Mode` attribute and can be left em
</Application.Styles>
```

### Theme Dictionary and Theme Variant

The method, `Styles.TryGetResource` method now requires a nullable `ThemeVariant` parameter as per PR #8166. This allows users to specify `Light`, `Dark`, and `Default`

Using `ThemeVariant.Default` as the key marks a specific theme dictionary as a fallback in case the theme variant or resource key is not found in other theme dictionaries.

In addition to the built-in values of `Light`, `Dark`, and `Default`, any object value can be used as a key (_since it's wrapped in the `ThemeVariant(object key)` structure_). `{x:Static}` markup extension can also be used here if a developer wants to define multiple custom themes as static properties and reference them from the XAML code.

```cs
// Before
bool TryGetResource(object key, out object? value)

// Avalonia v11
bool TryGetResource(object key, ThemeVariant? theme, out object? value)
```

## System.Reactive/Observables

Expand Down Expand Up @@ -312,4 +326,4 @@ Some applications were using the `AvaloniaLocator` as a general-purpose service
- Add `.GetTask()` to the end of calls to `Dispatcher.UIThread.InvokeAsync` if directly returning the value in a method which returns a `Task`
- `IRenderRoot.RenderScaling` has been moved to `TopLevel.RenderScaling`
- `LightweightObservableBase` and `SingleSubscriberObservableBase` have been made internal. These were utility classes designed for a specific purpose in Avalonia and were not intended to be used by clients as they do not handle certain edge cases. Use the mechanisms provided by `System.Reactive` to create observables, such as `Observable.Create`
- When binding to methods, the method must either have no parameters or a single object parameter.
- When binding to methods, the method must either have no parameters or a single object parameter.

0 comments on commit 12bf7ff

Please sign in to comment.