Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 4653, "IsTabStop property not working when Grid contains ScrollView", PlatformAffected.UWP)]
public class Issue4653 : TestContentPage
{
protected override void Init()
{
var grid = new Grid()
{
Padding = new Thickness(10),
BackgroundColor = Color.Aquamarine,
IsTabStop = false
};
grid.AddChild(new Button
{
Text = "Toggle Grid IsTabStop",
Command = new Command(() => grid.IsTabStop = !grid.IsTabStop)
}, 0, 0);
grid.AddChild(new Button
{
Text = "IsTabStop: false",
IsTabStop = false
}, 1, 0);

var buttonInSctoolView = new Button
{
Text = "Button inside tadded ScrollView",
IsTabStop = false
};
buttonInSctoolView.Command = new Command(() => {
buttonInSctoolView.IsTabStop = !buttonInSctoolView.IsTabStop;
buttonInSctoolView.Text = $"IsTabStop: {buttonInSctoolView.IsTabStop}";
});

grid.AddChild(new ScrollView
{
Content = buttonInSctoolView
}, 0, 1);

grid.AddChild(new Entry
{
Text = "entry"
}, 1, 1);

int col = 2;
grid.AddChild(new Button
{
Text = "Add default button",
IsTabStop = false,
Command = new Command(() => grid.AddChild(new Button { Text = "default" }, 0, ++col))
}, 0, 2);

int colNonTabbed = 2;
grid.AddChild(new Button
{
Text = "Add non tabbed button",
IsTabStop = true,
Command = new Command(() => grid.AddChild(new Button { Text = "non tabbed", IsTabStop = false }, 1, ++colNonTabbed))
}, 1, 2);

Content = new StackLayout
{
Children =
{
grid
}
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla31145.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla31333.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla31366.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue4653.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla31964.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla32033.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla32034.cs" />
Expand Down
6 changes: 6 additions & 0 deletions Xamarin.Forms.Platform.UAP/IDontGetFocus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Xamarin.Forms.Platform.UWP
{
public interface IDontGetFocus
{
}
}
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.UAP/ITabStopOnDescendants.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Xamarin.Forms.Platform.UWP
{
public interface ITabStopOnDescendants
public interface ITabStopOnDescendants: IDontGetFocus
{
}
}
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.UAP/ScrollViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Xamarin.Forms.Platform.UWP
{
public class ScrollViewRenderer : ViewRenderer<ScrollView, ScrollViewer>
public class ScrollViewRenderer : ViewRenderer<ScrollView, ScrollViewer>, IDontGetFocus
{
VisualElement _currentView;
bool _checkedForRtlScroll = false;
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.Platform.UAP/VisualElementRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void SetElement(VisualElement element)

OnElementChanged(new ElementChangedEventArgs<TElement>(oldElement, Element));

if (_control != null && this is ITabStopOnDescendants)
if (_control != null && this is IDontGetFocus)
{
_control.GotFocus += OnGotFocus;
_control.GettingFocus += OnGettingFocus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Compile Include="CollectionViewRenderer.cs" />
<Compile Include="FormsCancelButton.cs" />
<Compile Include="AlertDialog.cs" />
<Compile Include="IDontGetFocus.cs" />
<Compile Include="FontImageSourceHandler.cs" />
<Compile Include="Items\ItemContentControl.cs" />
<Compile Include="FormsPivot.cs" />
Expand Down