Editing UINavigationBar translucence adds padding on bottom - c#

I've been developing with Xamarin and iOS for about two weeks now, and currently I'm attempting to figure out why a strange bug is happening. I've looked all over Google and even SO, but can't find an answer...one that works, anyways. As the title says, whenever I change the Translucent boolean property of my NavigationController.NavigationBar, extra padding is added for seemingly no reason. This can be seen in the image below:
The line of code I use for this is this.NavigationController.NavigationBar.Translucent = false; and without that line, the application looks like this:
Other than that line, the NavigationController.NavigationBar is unedited. So, does anyone know what I'm doing wrong? Any help would be much appreciated...thanks SO!

It depends on the way how you construct your views and their containments.
Make sure that EdgesForExtendedLayout (Apple Docu) has the right value. I would suggest UIRectEdge.All.
In the case you are using a scrollView als check the automaticallyAdjustsScrollViewInsets property.

So, I actually figured out through posting on the Xamarin Forums and browsing through their documentation that the UINavigationBar.Translucent property adjusts the view if you turn it off such that all of the screen's contents are visible beneath the now-opaque UINavigationBar. I was simply placing the UI elements with unnecessarily large Y-values because I was unaware of the screen change after .Translucent = false;
I changed the .Frame = new CGRect(x, y, w, h) properties of each UI element with respect to 0 being right below the navigation bar, not underneath it.

Related

Is there an option in chart.js to hide values in the graph legend

I've picked up a project from a former colleague but know nothing about javascript and/or chart.js, I'm trying to learn.
I've been asked to part of the graph/legend - red ring in the image.
The thing is the chartjs json string/structure is split into separate variables which make it pretty hard to follow - and also give code samples. I've tried changing the "options" string, i.e. options: {legend: {display:false }}, but it's still displaying.
Is the part marked red actually part of the legend or is it something else on the chart
Image showing what I need to hide
That isn't the legend. Somewhere in the options there is a property xAxes. Here your collegue has defined multiple new axes. These are the ones you see. If you remove them and remove the xAxisId from the datasets you will get what you want

DataTemplateSelector disappearing data on save mystery

I'm not even sure what to call it so let me explain the scenario and hopefully a light bulb goes off for somebody else. I can't do a full code share to reproduce because it just isn't an option, anyhow I digress.
So, here's the basics.
Multiple DataTemplate's set via;
public DataTemplate ABCTemplate
{
get { return (DataTemplate) GetValue(ABCTemplateProperty); }
set { SetValue(ABCTemplateTemplateProperty, value); }
}
Which are swapped out via;
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
var something = (thestuff)item;
switch (something.Id)
{
case (int)thestuff.Type.ABC: { return ABCTemplate; }
case (int)thestuff.Type.DEF: { return DEFTemplate; }
case (int)thestuff.Type.GHI: { return GHITemplate; }
case (int)thestuff.Type.JKL: { return JKLTemplate; }
}
return base.SelectTemplate(item, container);
}
etc, etc, etc. Each DataTemplate is a DataGrid (no I did not make this and I can't rewrite it).
Here's the weird mystery part that has me stumped that I'll explain best I can.
On initial load of the screen everything is fine, the data loads fine, everything is peachy. HOWEVER upon Save (even without any changes) once the busy indicator disposes then ONLY the Column Headers of the DataGrids will remain visible UNTIL you resize the screen even the slightest bit. Which I assume causes SizeChanged to UpdateLayout()?
My question is, has anyone seen this behavior before? Why the hell would the DataGrid of each template render the Column Headers, but then NOT render the rows until just a SizeChanged event, and most importantly, how can I fix this P.O.S.?
I tried the first stuff I could think of like just hard setting some sizes since I took a shot in the dark on the fact that changing the window size even the slightest bit causes the data to return to view but in reality, I'm stumped and doing that just made it less predictably reproducible.
I'll happily buy beer for anyone that can save my sanity. Thanks.
This actually does ring a bell. I had to fight a similar DataGrid rendering issue. Here is my story:
The content disappeared or was completely white when we added columns, after a while I found out it happened when the combined width of all columns exceeded a certain number. I don't think it was Int32.MaxValue, it was probably a smaller number, maybe it was a power of two, but that is not important or required. (see my explanation further down)
So your save operation's busy indicator might effect the visualState in any way, some kind of focus border or stuff might be rendered and just hits this magical limit, an overflow will happen.
Now imagine some code that for example calculates the width of a contentPanel or Presenter (or anything related to showing your content) sums up all the parts, and an overflow happens, what will be the result? yeah, exactly, the width will be far in the negative. So it actually might be rendered by the engine, either off screen or just outside of the element's actual display area.
You can actually reproduce this and witness it with a TextBox in a try-out project: Have a TextBox and fill it with random characters via Ctrl+A, Ctrl+C, Ctrl+V, and onTextChanged -> Debug.WriteLine(textbox.Text.GetRenderedWidth()).
(GetRenderedWidth is an extension method I wrote, can give you the code if you want. But it is not super accurate.)
As soon as the rendered width reaches ca. 39,235 you can see a change in the rendering of the Ctrl+A text highlighter: The content is gone! But actually it is just rendered into negative direction (you can turn on EnableRedrawRegions to see it rendered in the wrong direction). and everything is back to normal when you remove the last character again.
So my advise is: turn on EnableRedrawRegions, see if you can see a change of the redrawn regions when your rendering issue occurrs. If you can spot a region is drawn just left of you DataGrid, chances are that that is actually your grid content.
[Edit 1]
If it turns out that the visualState change of the grid is somehow causing this bug, your fix might be as simple as onBusyIndicatorDone -> VisualStateManager.GoToState(grid,"normal",false);
[Edit 2]
You can trigger a redraw with InvalidateArrange or InvalidateMeasure: grid.InvalidateArrange() or grid.InvalidateMeasure()

How to hide document area between panels in DockPanelSuite

I am trying to develop an interface using DockPanelSuite with only a left and right window (I want them to look the same). When using DockPanelSuite you cannot set the width of the document area and there is a gap between the panels (see the green area in image below). Does anyone know how to hide or remove the document are for DockPanel Suite? Below is the code I use to show the panels.
dockPanel.DockRightPortion = .75;
dockPanel.DockLeftPortion = .25;
_libraryBrowser.Show(dockPanel, DockState.DockLeft);
_pageDisplay.Show(dockPanel, DockState.DockRight);
I also encountered a similar issue a long time ago, the only way I found to solve it is to change how the bigger panel is shown. In your case:
_libraryBrowser.Show(dockPanel, DockState.Document);
_pageDisplay.Show(dockPanel, DockState.DockRight);
I know that probably is not what you expect to do, but is a way to solve the issue.

how can I lock shapes in PowerPoint?

I'm working on a Add-in for PowerPoint 2010 (C#) and I want to prevent the end-user to move or edit all the shapes that I have programmatically created.
I have already sought in the framework but I think it's not allowed programmaticaly. Has anyone already encountered this kind of limitations and could help me to find a solution?
I know that some people create their add-in thanks to C++ because there are a lot of limitations in office.
I have found two solutions :
The first is to catch all events from the "commandBars.OnUpdate" like this great sample code : http://code.msdn.microsoft.com/CSExcelNewEventForShapes-0e26b1f2#content
Then you can impose the position/the color or everything you want to your shape.
The second one is more "brutal" > unselect immediately the shape. When you catch all the events from the "CommandBars.OnUpdate" do this :
To see which shape is selected :
var selectedShape = this.Application.ActiveWindow.Selection.ShapeRange[1]
In all my shapes, I have set a tag with an ID. I have just to check that there are an ID in the tags of the selectedShape and if this is the case :
this.Application.ActiveWindow.Selection.Unselect();
Then I show a messageBox to warn the user to do not select this kind of shape.
I don't like this solution but it's the only one that I have found and it works.
I believe this is not possible. A way of achieving this to a certain extent (people can work around it if they figure out how to select the shapes below) is by making a transparent rectangle the size of the canvas and binding a custom event to that (like you described in your comment). The transparent rectangle is overlaying the shapes you created so people can no longer access the shapes that way. Of course if they are capable of figuring out how to select the shapes they can move them anyway...
Alternatively, to make people not do stuff like that (you only stop the inexperienced) you can also set them up as master slides.
Only 'real' solution for people not doing that? Images .. but then they can move the image too!

Hide or change the "no data in local tile cache" message in GMap.NET

I'm using GMap.NET. When zooming too much on the map and no image is available for the zone, a exception square prints on the map. This is OK, I don't want to change the behavior. I just want to make up the GmapControl, and I'm almost done. All I need now is changing or removing the exception message : "Exception : no data in local tile cache". But I can't find the right property...
For people interested in, I've asked on the GMAP official topic, and I had some interesting answers, except for this one part : http://greatmaps.codeplex.com/discussions/389159
As already mentioned in http://greatmaps.codeplex.com/discussions/389159, I embarked on a similar mission:
mapControl.EmptytileBrush = new SolidBrush(Color.Gainsboro);
mapControl.EmptyTileText = String.Empty;
mapControl.EmptyTileBorders = new Pen(Color.Gray);
However, GMap exposes no property to hide the exception text, and after removing the offending DrawString inside (GMAP v1.6, line 753 of GMapControl.cs), I recompiled and found that the binaries were not the same as the source!
The recompiled source, now does not display the exception text at all (when using cached mode only).
As a result - all that was necessary in my case was a rebuild or Core and WinForms.
When zooming in, GMAP now uses previous map data as far as possible, then eventually draws a blank white tile by default when the zoom is about 10 levels lower than the previously available level.
This behavior is acceptable - after all, who except for a debugger/developer would want to see bright exception text instead of a blank image? :)

Categories

Resources