Windows 10 Mobile height of soft keyboard - xaml

Does anybody know how to move content of the page (maybe set relative margins or something like that) when soft keyboard is shown.
Here is the example page from my application.
So I want when the user starts typing a phone number in the text box the bottom button will be shown above the soft keyboard. As a result I want something like that:
P.S: Sorry about Russian language on the screens.

It's kind of tricky, but as I've tried should work. I've used InputPane's showing and hiding events to change the translate transform of the button. In page's constructor I've added such code:
Windows.UI.ViewManagement.InputPane.GetForCurrentView().Showing += (s, args) =>
{
GeneralTransform gt = loginButton.TransformToVisual(this);
Point buttonPoint = gt.TransformPoint(new Point(0, loginButton.RenderSize.Height - 1));
var trans = new TranslateTransform { Y = -(buttonPoint.Y - args.OccludedRect.Top) };
loginButton.RenderTransform = trans;
args.EnsuredFocusedElementInView = true;
};
Windows.UI.ViewManagement.InputPane.GetForCurrentView().Hiding += (s, args) =>
{
var trans = new TranslateTransform { Y = 0 };
loginButton.RenderTransform = trans;
args.EnsuredFocusedElementInView = false;
};
You only have to remember that InputPane is for the whole app - once you leave the page, you will probably have to unsubscribe from those events, otherwise you will likely get exceptions.

Related

Adobe Photoshop Scripting - How to Select Bounding Box Around Current Selection?

Does anyone know whether it's possible, in Photoshop extend script, to convert an irregular selection (e.g. magic wand tool selection) into a rectangular selection encompassing the top, left, bottom and right bounds of the selection?
Here it is, I have documented the code so you can modify it later if you need. Also, check page 166 and following of Photoshop's JS reference manual, you may read more about selections - you can set feather, extend/intersect/etc. the selection if you need to.
Made for CS6, should work with latter.
#target photoshop
if (documents.length == 0) {
alert("nothing opened");
} else {
// start
//setup
var file = app.activeDocument;
var selec = file.selection;
//run
var bnds = selec.bounds; // get the bounds of current selection
var // save the particular pixel values
xLeft = bnds[0],
yTop = bnds[1],
xRight = bnds[2],
yBottom = bnds[3];
var newRect = [ [xLeft,yTop], [xLeft,yBottom], [xRight,yBottom], [xRight,yTop] ]; // set coords for selection, counter-clockwise
selec.deselect;
selec.select(newRect);
// end
}

how to add arcgis button in a windows form

I am new in ArcGis. I came across a requirement that I need a command on the ArcGis Toolbar. On click the command, a Windows Form will open and there one region selector button is there. upon clicking on the button, the current Form UI must be minimized and the user will be allowed to draw a polygon. Can you please help on how to do that. Here is the code. I took normal windows button and wrote the below code in the click event.
_application = ((IApplication)_hookHelper.Hook);
IMxDocument pMxDoc = (IMxDocument)_application.Document;
IMap pMap = (IMap)pMxDoc.FocusMap;
IActiveView pActiveView = (IActiveView)pMap;
if (pActiveView == null)
{
return;
}
//// Changing the state of the Window.
if (this.WindowState == FormWindowState.Normal || this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Minimized;
// this.Hide();
}
ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = pActiveView.ScreenDisplay;
// Constant
screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast
ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
rgbColor.Blue = 111;
ESRI.ArcGIS.Display.IColor color = rgbColor; // Implicit Cast
ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
simpleFillSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = simpleFillSymbol as ESRI.ArcGIS.Display.ISymbol; // Dynamic Cast
ESRI.ArcGIS.Display.IRubberBand rubberBand = new ESRI.ArcGIS.Display.RubberRectangularPolygonClass();
// ESRI.ArcGIS.Display.IRubberBand rubberBand = new ESRI.ArcGIS.Display.RubberPolygonClass();
ESRI.ArcGIS.Geometry.IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);
screenDisplay.SetSymbol(symbol);
screenDisplay.DrawPolygon(geometry);
screenDisplay.FinishDrawing();
I am also not getting any mouse event and the UI is not minimized while starting drawing the polygon. Can anyone please help.
Have we check the white paper for ArcGIS runtime SDK for .Net?
http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#/Essential_vocabulary/01700000004z000000/

Xamarin Dim Page (Master Detail Page)

So for Android when the master page of a master-detail page is shown the master page is covered with a "black dim" view so it is easy to differentiate the two pages with the eye. In iOS the detail page is not dimmed so it is tougher to differentiate the views. Is there a way to overlay the details page with a BoxView or Frame that is "black translucent" so it dims the page in similar fashion to Android. I have tried many different colors and opacities of a box view but they all completely cover the screen and you can't "see through them". Any ideas? Or better solutions? Even if it is a customer renderer for the BoxView that will work. I just need color ideas/settings to make it see through.
Sample here:
https://github.com/jgold6/XamarinSupportSamples/tree/master/XForms-TestShadingiOSDetailPage
Here's the code in case the link ever breaks:
MasterDetailPage mdPage;
Color origContentBgColor;
Color origPageBgColor;
public App()
{
mdPage = new MasterDetailPage();
mdPage.IsPresentedChanged += async (object sender, EventArgs e) => {
if (Device.OS == TargetPlatform.iOS) {
if (mdPage.IsPresented) {
var currentPage = (DetailPage)((NavigationPage)mdPage.Detail).CurrentPage;
origPageBgColor = currentPage.BackgroundColor;
origContentBgColor = currentPage.Content.BackgroundColor;
currentPage.BackgroundColor = Color.Black;
currentPage.Content.FadeTo(0.5);
if (currentPage.Content.BackgroundColor == Color.Default) {
currentPage.Content.BackgroundColor = Color.White;
}
}
else {
var currentPage = (DetailPage)((NavigationPage)mdPage.Detail).CurrentPage;
currentPage.BackgroundColor = origPageBgColor;
currentPage.Content.BackgroundColor = origContentBgColor;
currentPage.Content.FadeTo(1.0);
}
}
};
mdPage.Master = new MasterPage(){Title = "Master Page"};
mdPage.Detail = new NavigationPage( new DetailPage());
// The root page of your application
MainPage = mdPage;
}
I just changed the order of FadeTo() method to be the last command and the dark black effect is gone!
await currentPage.Content.FadeTo(0.5);

updateSeries during onclick event of a chart column works as expected only when debugging in Chrome

Using dojo, I create a chart with ColumnsPlot.
The chart is created and displayed the way I want it.
In order to handle a click on a column and to change the color of the clicked column I have the code below:
var handler = barChart.connectToPlot("default", function (event) {
if (event.type == "onclick") {
var currentSeriesData = event.run.data;
barChart.updateSeries("Yearly Offense Count", reverseColors(currentSeriesData, event.index));
barChart.render();
}
});
And the reverseColors is:
reverseColors = function (data, index) {
var tempData = [];
for (var i = 0; i < data.length; i++) {
tempData.push(data[i]);
if (i == index) {
tempData[i].fill = "red";
} else {
tempData[i].fill = "green";
}
}
console.log(i + " - " + tempData[i].fill);
return tempData;
}
I am testing in Google and using the Developers Tools to debug. If I set a break point inside the if statement and debug the app, the barChart is updated and the clicked columns get a red color, and all the others are green (as desired).
If I am not debugging, the barChart is updated, but all columns are green (originally chart is created with all green columns except one red column).
The reverseColors function returns the data in the correct format and wiht the correct fill while debugging, and when not debugging in the console I have 1 red and the rest of the items are green, as expected. But my chart has only green columns.
What am I messing up?
Dojo beginner!
Edit: Doesn't work in Chrome, works once in a blue moon in Firefox, and works fine is IE8.
The chart had a Highlight defined.
Removing the Highlight solved the problem.

controlling X and Y of spark.components.Window

I am building an air app in Flex 4. I am creating windows as I need them in a chromeless application.
Here is what I have in my main app creation complete
protected function creationCompleteHandler(event:FlexEvent):void
{
facade.sendNotification(AppFacade.APP_INIT, this);
var buttons:NavigatorWindow = new NavigatorWindow();
var workingSets:WorkingSets = new WorkingSets();
buttons.addElement( workingSets );
buttons.width = 115;
buttons.height =200;
buttons.maximizable = false;
buttons.resizable = false;
buttons.addEventListener(AIREvent.WINDOW_COMPLETE, onWindowComplete);
buttons.open();
}
private function onWindowComplete(event:AIREvent):void
{
event.currentTarget.x = 100;
event.currentTarget.y = 100;
}
for some reason the application adds the window in the middle of the screen and if I set the x and y of the Window it does not put it where I expect in the upper left of my screen. How do I position the window where I would like when it is opened?
thanks,
The spark.components.Window exists inside a NativeWindow you'll need to position the NativeWindow if you want to move it around on the screen. It is a bit confusing because you can position the Window inside the native window as well. You'll have to do the positioning after creation complete, otherwise you'll get null reference errors.
You could invoke the window like this if you created a component based on spark.components.Window:
var win:MyWindow = new MyWindow(); //MXML component
win.height = 150;
win.width = 300;
win.systemChrome = NativeWindowSystemChrome.NONE;
win.type = NativeWindowType.LIGHTWEIGHT;
win.showStatusBar = false;
win.transparent = true;
win.alwaysInFront = true;
win.open(true);
Then in that mxml component, you set an creationComplete event handler to do this:
var padding:int = 25;
this.nativeWindow.x = Screen.mainScreen.visibleBounds.right - this.width - padding;
this.nativeWindow.y = Screen.mainScreen.visibleBounds.top + padding;
This should put your new window in the top right hand corner with 25px of padding on the top and right.