-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use HasBinding for Wpf/Uno in place of BindingOperations.GetBinding
- Loading branch information
1 parent
a63b29f
commit f85446c
Showing
5 changed files
with
40 additions
and
15 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/Uno/Prism.Uno/Extensions/DependencyObjectExtensions.Uno.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Data; | ||
|
||
namespace Prism | ||
{ | ||
internal static partial class DependencyObjectExtensions | ||
{ | ||
/// <summary> | ||
/// Compatibility method to determine if the current thread can access a <see cref="DependencyObject"/> | ||
/// </summary> | ||
/// <param name="instance">The instance to check</param> | ||
/// <returns><c>true</c> if the current thread has access to the instance, otherwise <c>false</c></returns> | ||
public static bool CheckAccess(this DependencyObject instance) | ||
#if __WASM__ | ||
// This needs to evolve, once threading is supported | ||
// See https://github.com/unoplatform/uno/issues/2302 | ||
=> System.Threading.Thread.CurrentThread.ManagedThreadId == 1; | ||
#else | ||
=> instance.Dispatcher.HasThreadAccess; | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters