Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtk DisplayActionSheet fix #1

Merged
merged 3 commits into from
Dec 22, 2017
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
30 changes: 30 additions & 0 deletions Xamarin.Forms.Controls/GalleryPages/ActionSheetGallery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,35 @@ public ActionSheetGallery ()
"Extra Eleven",
};


var extras25 = new string[] {
"Extra One",
"Extra Two",
"Extra Three",
"Extra Four",
"Extra Five",
"Extra Six",
"Extra Seven",
"Extra Eight",
"Extra Nine",
"Extra Ten",
"Extra Eleven",
"Extra Twelve",
"Extra Thirteen",
"Extra Fourteen",
"Extra Fifteen",
"Extra Sixteen",
"Extra Seventeen",
"Extra Eightteen",
"Extra Nineteen",
"Extra Twenty",
"Extra Twenty-one",
"Extra Twenty-two",
"Extra Twenty-three",
"Extra Twenty-four",
"Extra Twenty-five",
};

Content = new ScrollView {
Content = new StackLayout {
Spacing = 0,
Expand All @@ -45,6 +74,7 @@ public ActionSheetGallery ()
MakeActionSheetButton (this, "ActionSheet Title Destruction", "Title", null, "Destruction"),
MakeActionSheetButton (this, "ActionSheet Title Destruction Extras", "Title", null, "Destruction", extras),
MakeActionSheetButton (this, "ActionSheet Title Extras", "Title", null, null, extras),
MakeActionSheetButton (this, "ActionSheet Title Cancel Destruction 25xExtras", "Title", "Cancel", "Destruction", extras25),
}
}
};
Expand Down
22 changes: 19 additions & 3 deletions Xamarin.Forms.Platform.GTK/Helpers/DialogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ private static void SetDestructionButton(string destruction, MessageDialog messa

private static void AddExtraButtons(ActionSheetArguments arguments, MessageDialog messageDialog)
{
var vbox = messageDialog.VBox;
var newVBox = new VBox(messageDialog.VBox.Homogeneous, messageDialog.VBox.Spacing);

// As we are not showing any message in this dialog, we just
// hide default container and avoid it from using space
vbox.Children[0].Hide();
messageDialog.VBox.Children[0].Hide();

if (arguments.Buttons.Any())
{
Expand All @@ -124,9 +124,25 @@ private static void AddExtraButtons(ActionSheetArguments arguments, MessageDialo
};
button.Show();

vbox.PackStart(button, false, false, 0);
newVBox.PackStart(button, false, false, 0);
}
}
newVBox.Show();

int maxScrollHeight = (int)(0.6 * messageDialog.Screen.Height);
if (newVBox.SizeRequest().Height >= maxScrollHeight) {
var scrolledWindow = new ScrolledWindow();
scrolledWindow.HscrollbarPolicy = PolicyType.Automatic;
scrolledWindow.VscrollbarPolicy = PolicyType.Always;
scrolledWindow.BorderWidth = 0;
scrolledWindow.HeightRequest = maxScrollHeight;
scrolledWindow.AddWithViewport(newVBox);
scrolledWindow.Show();

messageDialog.VBox.PackStart(scrolledWindow,false,false,0);
} else {
messageDialog.VBox.PackStart(newVBox,false,false,0);
}
}
}
}
3 changes: 3 additions & 0 deletions Xamarin.Forms.Platform.GTK/Renderers/SliderRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
// Use gtk.HScale, a horizontal slider widget for selecting a value from a range.
SetNativeControl(new Gtk.HScale(_minimum, _maximum, stepping));
Control.ValueChanged += OnControlValueChanged;

// Hide the slider value (for consistency with other XF Platforms)
Control.DrawValue = false;
}

UpdateMaximum();
Expand Down