I want to use popUp element in windows phone (C#) to view a message on screen
I did the following:
popUpBanner = new Popup();
popUpBanner.HorizontalAlignment = HorizontalAlignment.Center;
popUpBanner.VerticalAlignment = VerticalAlignment.Center;
But the popup element appears in the top left of the screen .. not at the center
How can I solve this
In Windows Phone the Pop up is not a UserControl class. Instead of centering the popup you want to center the ui elements within the popup's child element...
To be more specific, I updated my code and hope it helps you.
First lets get the screen size(i.e. Width & Height)
var width = System.Windows.Application.Current.Host.Content.ActualWidth;
var height = System.Windows.Application.Current.Host.Content.ActualHeight;
Lets create a StackPanel, adding background color to it and re-sizing the StackPanel according to the device screen resolution.
StackPanel stackPanel = new StackPanel();
stackPanel.Background = new SolidColorBrush(Colors.Gray);
stackPanel.Height = height / 4;
stackPanel.Width = width / 2;
Finally Create a Popup and add it as a children to the StackPanel.
Popup Popup1 = new Popup();
stackPanel.Children.Add(Popup1);
ContentPanel.Children.Add(stackPanel);
Popup1.IsOpen = true;
You are done. Modify your StackPanel size according to your need, since you got the screen resolution here.
Related
I need to create the tabbed menu as per Youtube's latest UI and show the menu at the top on Android and iOS.
The default behavior on Android is to show menu at the top so that's working fine.
On iOS I have created a custom render and I am using following code to change the position of the bar to the top:
UIInterfaceOrientation orientation = UIApplication.SharedApplication.StatusBarOrientation;
if (UIInterfaceOrientation.LandscapeLeft == orientation || UIInterfaceOrientation.LandscapeRight == orientation)
{
tabSize = 32.0f;
}
CGRect tabFrame = this.TabBar.Frame;
tabFrame.Height = tabSize;
tabFrame.Y = this.View.Frame.Y;
this.TabBar.Frame = tabFrame;
this.TabBar.ContentMode = UIViewContentMode.ScaleToFill;
// Set the translucent property to NO then back to YES to
// force the UITabBar to reblur, otherwise part of the
// new frame will be completely transparent if we rotate
// from a landscape orientation to a portrait orientation.
this.TabBar.Translucent = false;
this.TabBar.Translucent = true;
//this.TabBar.Translucent = false;
this.TabBar.SetNeedsUpdateConstraints();
My problem is that there is some white space at the bottom to compensate for the bar which is already moved to the top.
Does any one knows how to fix this?
This problem is also in following post but I am not able to find answer.
https://forums.xamarin.com/discussion/comment/226114/#Comment_226114
I'm trying to determine how, using javafx, to approach displaying cells (image thumbnails or images) similar to Windows Explorer where images are shown in rows that wrap at horizontal boundaries but scroll in the vertical direction.
Is a tableview the approach to use and then update the column number when the view is resized? A little help would be greatly appreciated. Better yet a simple example code.
I'm pretty new to this forum and I have searched but can't really get started on this.
Thanks
Wrapping a FlowPane inside a ScrollPane would be a much simpler approach to the problem.
Example:
This uses some rectangles with numbers instead of images, but I think it's enough to get an idea how to use the Layouts:
FlowPane contentContainer = new FlowPane();
contentContainer.setVgap(10);
contentContainer.setHgap(10);
ScrollPane scroll = new ScrollPane(contentContainer);
scroll.setFitToWidth(true);
// fill FlowPane with some content
ArrayList<Node> content = new ArrayList<>();
for (int i = 0; i < 15; i++) {
Text text = new Text(Integer.toString(i));
text.setFill(Color.YELLOW);
StackPane pane = new StackPane(text);
pane.setStyle("-fx-background-color: blue;");
pane.setPrefSize(50, 50);
content.add(pane);
}
contentContainer.getChildren().setAll(content);
I am new to webix and have a problem with ui.window!
For me the window never adjusts to the parent HTML element. :(
I want the window to have the same width and height as the parent (100%).
What am I dowing wrong?
See code in Webix Snippets: http://webix.com/snippet/c5fe5e96
According to the documentation:
"Window Sizing and Positioning
The must-have parameters for the window are width and height. If you don't set [them], the window [...] will occupy the whole screen."
http://docs.webix.com/desktop__window.html
"adjust - adjusts the component to the size of the parent html container"
http://docs.webix.com/api__link__ui.popup_adjust.html
Window and Popup widgets are working for the whole app, they are not using container and can't use .adjust as well.
You can size the Window to the document by using fullscreen option
var popup = webix.ui({
view: "window",
fullscreen:true,
http://webix.com/snippet/93a5e3ba
or by using the complex position property
var popup = webix.ui({
view: "window",
position:function(state){
state.left = state.top = 10;
state.width = state.maxWidth - 20;
state.height = state.maxHeight-20;
},
http://webix.com/snippet/164a3955
I have managed to make the window inherit the size of the HTML container by getting the HTML container size by using getNode() and then using setPosition, config.width, config.height and resize().
See example below.
http://webix.com/snippet/056b9610
When I set the textbox's anchor to top,bottom,left,right the textbox still stays on the top. I don't understand, this seems to work for labels and buttons. I kinda need this anchor property for it to adapt well to a form resize.
I'm sorry if I'm missing something incredibly obvious.
If I understand your question, you want a single line textbox to appear centered vertically and horizontally in your form. Still without showing more than one line. In this case you could set just the Anchor Left and Right property to have you textbox centered horizontally on the form, but for the vertical position you need to work with code adjusting the Iop property of the textbox in the Resize event of the form
For example, after the call to InitializeCompoment of your form you could add the following code to center your textbox (C# but easily convertible to VB.NET)
textBox1.Left = 10;
textBox1.Width = yourForm.ClientSize.Width - 20;
textBox1.Top = (yourForm.ClientSize.Height / 2) - yourForm.Height / 2;
textBox1.Anchor = AnchorStyles.Left | AnchorStyles.Right;
and then add the event handler for the resize event of your form where you could call again the vertical repositioning of the textbox
protected void yourForm_Resize(object sender, EventArgs e)
{
textBox1.Top = (this.ClientSize.Height / 2) - textBox1.Height / 2;
}
I am using tkinter when and trying to set up a window with a background image. In some of the processes I have a frame that fills up with checkboxes so I created a scrollbar so the user can see all the options. The problem is the scroll bar also moves the background image of the canvas. Is there a way I can fix the image to not move or somehow move the frame by itself.
code is
def canvasScroll():
canvas = gui.createCanvas()
fFrame = gui.createNewFrame()
scrollbar = Scrollbar(root, orient="vertical", command=canvas.yview)
canvas.configure(yscrollcommand = scrollbar.set)
scrollbar.pack(side="right", fill="y")
canvas.pack(side="left", fill="both", expand= True)
canvas.create_window((150,50),window = fFrame, anchor='nw', tags = "frame")
gOb.change_canvas(canvas)
fFrame.bind("<Configure>", gui.scroll)
gOb.change_scrollbar(scrollbar)
gOb.change_frame(fFrame)
def createCanvas():
canvas = Canvas(root,height = _h, width = _w,highlightthickness = 0)
canvas.pack(side='top',fill='both',expand='yes')
canvas.create_image(-200,-200,image=bground,anchor='nw')
return canvas
def createNewFrame():
frame = Frame(root,height = _h, width = _w,background='white')
frame.pack()
return frame
Just to clear things up, these guys are all part of a class name gui and gOb is an object that hold several gui objects.
Here's one idea - it's kind of kludgy, but it would work. Every time the scrollbar scrolls, shift the background image's position so it appears to stay in the same place:
Tag your image so you can access it later:
canvas.create_image(-200,-200,image=bground,anchor='nw',tags="background")
# ^^^^^^^^^^^^^^^^^
Make your scrollbar call a function that you define:
scrollbar = Scrollbar(root, orient="vertical", command=scrollCallback)
Define your scroll callback:
def scrollCallback(*args):
canvas.yview(*args)
# Arrange for your background image to move so it appears to stay in the same position as the canvas scrolls.