Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions docs/dock-custom-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,18 @@ This package provides `INotifyPropertyChanged` implementations without the addit

public bool Match(object? data)
{
// Match your framework's base types
return data is YourFrameworkBaseType || data is IDockable;
if (data is null)
{
return false;
}

if (data is IDockable)
{
return true;
}

var name = data.GetType().FullName!.Replace("ViewModel", "View");
return Type.GetType(name) is not null;
}
}
```
Expand Down
21 changes: 19 additions & 2 deletions docs/dock-inpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ Follow these instructions to create a minimal INPC-based application using Dock.

public bool Match(object? data)
{
return data is INotifyPropertyChanged || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
```
Expand Down Expand Up @@ -108,7 +114,18 @@ Follow these instructions to create a minimal INPC-based application using Dock.

public bool Match(object? data)
{
return data is INotifyPropertyChanged || data is IDockable;
if (data is null)
{
return false;
}

if (data is IDockable)
{
return true;
}

var name = data.GetType().FullName?.Replace("ViewModel", "View");
return Type.GetType(name) is not null;
}
}
```
Expand Down
21 changes: 19 additions & 2 deletions docs/dock-mvvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ The following steps walk you through creating a very small application that uses

public bool Match(object? data)
{
return data is ObservableObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
```
Expand Down Expand Up @@ -111,7 +117,18 @@ The following steps walk you through creating a very small application that uses

public bool Match(object? data)
{
return data is ViewModelBase || data is IDockable;
if (data is null)
{
return false;
}

if (data is IDockable)
{
return true;
}

var name = data.GetType().FullName?.Replace("ViewModel", "View");
return Type.GetType(name) is not null;
}
}
```
Expand Down
21 changes: 19 additions & 2 deletions docs/dock-reactive-property.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ Follow these instructions to create a ReactiveProperty-based application using D

public bool Match(object? data)
{
return data is ReactiveBase || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
```
Expand Down Expand Up @@ -112,7 +118,18 @@ Follow these instructions to create a ReactiveProperty-based application using D

public bool Match(object? data)
{
return data is ReactiveBase || data is IDockable;
if (data is null)
{
return false;
}

if (data is IDockable)
{
return true;
}

var name = data.GetType().FullName?.Replace("ViewModel", "View");
return Type.GetType(name) is not null;
}
}
```
Expand Down
16 changes: 13 additions & 3 deletions docs/dock-reactiveui-di.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,20 @@ Follow these instructions to create a ReactiveUI application with dependency inj

public bool Match(object? data)
{
return data is ReactiveObject || data is IDockable;
}
if (data is null)
{
return false;
}

IViewFor? IViewLocator.ResolveView<T>(T? viewModel, string? contract) where T : default =>
if (data is IDockable)
{
return true;
}

return Resolve(data) is not null;
}

IViewFor? IViewLocator.ResolveView<T>(T? viewModel, string? contract) where T : default =>
viewModel is null ? null : Resolve(viewModel);
}
```
Expand Down
8 changes: 7 additions & 1 deletion docs/dock-reactiveui-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ Follow these instructions to create a ReactiveUI application with routing using

public bool Match(object? data)
{
return data is ReactiveObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
```
Expand Down
28 changes: 22 additions & 6 deletions docs/dock-reactiveui.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ Follow these instructions to create a minimal ReactiveUI based application using

public bool Match(object? data)
{
return data is ReactiveObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
```
Expand Down Expand Up @@ -140,16 +146,26 @@ Follow these instructions to create a minimal ReactiveUI based application using
if (Resolve(data) is IViewFor view && view is Control control)
return control;

var viewName = data.GetType().FullName?.Replace("ViewModel", "View");
return new TextBlock { Text = $"Not Found: {viewName}" };
}
var viewName = data.GetType().FullName?.Replace("ViewModel", "View");
return new TextBlock { Text = $"Not Found: {viewName}" };
}

public bool Match(object? data)
{
return data is ReactiveObject || data is IDockable;
if (data is null)
{
return false;
}

if (data is IDockable)
{
return true;
}

return Resolve(data) is not null;
}

IViewFor? IViewLocator.ResolveView<T>(T? viewModel, string? contract) where T : default =>
IViewFor? IViewLocator.ResolveView<T>(T? viewModel, string? contract) where T : default =>
viewModel is null ? null : Resolve(viewModel);
}
```
Expand Down
8 changes: 7 additions & 1 deletion docs/dock-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ public partial class ViewLocator : IDataTemplate

public bool Match(object? data)
{
return data is ObservableObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
```
Expand Down
21 changes: 19 additions & 2 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ This short guide shows how to set up Dock in a new Avalonia application. You wil

public bool Match(object? data)
{
return data is ObservableObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
```
Expand Down Expand Up @@ -114,7 +120,18 @@ This short guide shows how to set up Dock in a new Avalonia application. You wil

public bool Match(object? data)
{
return data is ViewModelBase || data is IDockable;
if (data is null)
{
return false;
}

if (data is IDockable)
{
return true;
}

var name = data.GetType().FullName?.Replace("ViewModel", "View");
return Type.GetType(name) is not null;
}
}
```
Expand Down
8 changes: 7 additions & 1 deletion samples/DockInpcSample/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public partial class ViewLocator : IDataTemplate

public bool Match(object? data)
{
return data is INotifyPropertyChanged || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
8 changes: 7 additions & 1 deletion samples/DockMvvmSample/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public partial class ViewLocator : IDataTemplate

public bool Match(object? data)
{
return data is ObservableObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
8 changes: 7 additions & 1 deletion samples/DockReactivePropertySample/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public partial class ViewLocator : IDataTemplate

public bool Match(object? data)
{
return data is ObservableObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
7 changes: 6 additions & 1 deletion samples/DockReactiveUIDiSample/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ public ViewLocator(IServiceProvider provider)

public bool Match(object? data)
{
return data is ReactiveObject || data is IDockable;
if (data is null)
{
return false;
}

return data is IDockable || Resolve(data) is not null;
}

IViewFor? IViewLocator.ResolveView<T>(T? viewModel, string? contract) where T : default => viewModel is null ? null : Resolve(viewModel);
Expand Down
13 changes: 12 additions & 1 deletion samples/DockReactiveUIRoutingSample/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public partial class ViewLocator : IDataTemplate

public bool Match(object? data)
{
return data is ReactiveObject || data is IDockable;
if (data is null)
{
return false;
}

if (data is IDockable)
{
return true;
}

var viewLocator = Locator.Current.GetService<IViewLocator>();
return viewLocator?.ResolveView(data) is not null;
}
}
8 changes: 7 additions & 1 deletion samples/DockReactiveUISample/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public partial class ViewLocator : IDataTemplate

public bool Match(object? data)
{
return data is ReactiveObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
8 changes: 7 additions & 1 deletion samples/Notepad/ViewLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public partial class ViewLocator : IDataTemplate

public bool Match(object? data)
{
return data is ObservableObject || data is IDockable;
if (data is null)
{
return false;
}

var type = data.GetType();
return data is IDockable || s_views.ContainsKey(type);
}
}
Loading