Implement ScrollContainerProperty to allow plugins to disable the default scrollviewer wrapper on their controls
This commit is contained in:
@@ -272,6 +272,7 @@
|
|||||||
<Compile Include="Views\Entities\CharacterView.xaml.cs">
|
<Compile Include="Views\Entities\CharacterView.xaml.cs">
|
||||||
<DependentUpon>CharacterView.xaml</DependentUpon>
|
<DependentUpon>CharacterView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\Extensions.cs" />
|
||||||
<Compile Include="Views\ModListControl.xaml.cs">
|
<Compile Include="Views\ModListControl.xaml.cs">
|
||||||
<DependentUpon>ModListControl.xaml</DependentUpon>
|
<DependentUpon>ModListControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
24
Torch.Server/Views/Extensions.cs
Normal file
24
Torch.Server/Views/Extensions.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Torch.Server.Views
|
||||||
|
{
|
||||||
|
public static class Extensions
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty ScrollContainerProperty = DependencyProperty.RegisterAttached("ScrollContainer", typeof(bool), typeof(Extensions), new PropertyMetadata(true));
|
||||||
|
|
||||||
|
public static bool GetScrollContainer(this UIElement ui)
|
||||||
|
{
|
||||||
|
return (bool)ui.GetValue(ScrollContainerProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetScrollContainer(this UIElement ui, bool value)
|
||||||
|
{
|
||||||
|
ui.SetValue(ScrollContainerProperty, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -41,7 +41,9 @@ namespace Torch.Server.Views
|
|||||||
{
|
{
|
||||||
if (propertyChangedEventArgs.PropertyName == nameof(PluginManagerViewModel.SelectedPlugin))
|
if (propertyChangedEventArgs.PropertyName == nameof(PluginManagerViewModel.SelectedPlugin))
|
||||||
{
|
{
|
||||||
if (((PluginManagerViewModel)DataContext).SelectedPlugin.Control is PropertyGrid)
|
var plugin = ((PluginManagerViewModel)DataContext).SelectedPlugin;
|
||||||
|
|
||||||
|
if (plugin.Control is PropertyGrid || !plugin.Control.GetScrollContainer())
|
||||||
PScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
|
PScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
|
||||||
else
|
else
|
||||||
PScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
PScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
|
||||||
|
Reference in New Issue
Block a user