dotnet / dotnet/maui

Omit portions of xaml from build depending on Debug/Release environement

Open
#9,999 3 comments 3 reactions 0 assignees View on GitHub
area-xaml proposal/open
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 10h
Merged PRs (30d)
297

Description

### Description

Initially from https://github.com/xamarin/Xamarin.Forms/issues/13896
**The analogy of `#if DEBUG` in xaml.**
Provide a way to conditionally ignore xaml portions during build depending on environment DEBUG/release.
I am not talking about the design time, also some may suggest workarounds like binding `Isvisible` for each View to `DEBUG` constant thru a property or just comment-out the code.

A close example in wpf xaml (but not exactly what described in this issue) https://stackoverflow.com/a/19940157. in other words it's like commenting-out these portions during debug/release mode.

Since we are in MAUI now could we extend this feature to targeted platform ? Simply portion of code enclosed inside `#if |WINDOWS|ANDROID] .... #endif` but for xaml. But not sure about the usefulness of he latter point.

### Public API Changes

### Example
```

```
or maybe
```


```

### Intended Use-Case

Be able to omit/ignore some ui stuff intended for debug purposes only.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.