Custom draw selection rectangle - c#

I am working on a custom control based on a ListView control. The goal of the control is to show the events name in the first column and the event duration on a timeline on the second column. I've implemented the custom drawing for the timeline section and it all works.
Now I would like to implement a "zooming" feature. Where the user would be able to click somewhere on the second column drag the mouse and upon release the timeline would be zoomed in with starting and end times matching the mousedown/mouseup events.
Currently when I click/drag the mouse, a normal selection box appears. I would like to overide that such that I get don't get a box but more of a vertical area (so the selection is only based on the timeline axis).
I really don't know where to look and how to overide the drawing the selection box. Any pointers/sample code would be appreciated.

Well if you don't need multi selection option setting MultiSelect property to false disables rubber band selection.

Related

user control tool tip not working in transparent sections

I have a user control with a label and an icon. I have managed to get the tool tip to show when I hover over the label or icon. However it does not show when i hover over transparent parts of the user control. Is there a way to fix this.
I have placed the tool tip in the grid, stack panel, controls them self's and also the user control tags but still the tool tip does not treat the user control as the whole area to show the tool tip.
The default value of the Background property of a Panel is null, which means it does not get any input events.
From the Remarks section of the Panel.Background property page on MSDN:
Panel elements do not receive mouse or stylus events if a Background
is not defined. If you need to handle mouse or stylus events but do
not want a background for your Panel, use Transparent.

How can I allow a user to pan a map within a ListView in Xamarin.Forms?

I'm writing a survey-style app in Xamarin.Forms in which I have numerous question types displayed in a ListView. For example, a single ListView would contain several cells that show either an Entry (text box), a Picker (combobox), or a Switch (checkbox).
In one question type, I ask the user whether their current GPS position is accurate relative to some landmark. To help them gauge the accuracy, I display a map within the cell itself. The issue I'm running into is that the user is unable to scroll the map vertically because Xamarin.Forms seems will scroll the entire ListView instead of just the map. Horizontal scrolling on the map seems to work fine, but as soon as a slight vertical motion is detected the ListView begins to move.
Is there a way to prevent the ListView from scrolling when the user is attempting to pan the map itself? Perhaps a way for the map to intercept the touch event?
You can try to create a custom renderer for the ListView and disable it's scroll upon panning the map.
Here is the information about custom renderers:
https://developer.xamarin.com/guides/xamarin-forms/custom-renderer/
for android, check this post:
http://forums.xamarin.com/discussion/37835/disable-scrollview-scrolling-on-android
for iOS, check this post:
https://forums.xamarin.com/discussion/56318/scrollview-horizontal-completely-disable-vertical-scroll

Make control transparent to drag events during drag-and-drop

I have a ListView that acts as a drop target for drag and drop operations. When the list is empty, I place a TextBlock over top of it with a message informing users they can drag things there (both controls are contained in a single Grid cell to enable overlap). But... since the TextBlock is on top of the ListView, it intercepts the various events connected to drag and drop and prevents things from being dropped onto the message text itself.
I really don't want to add a drop handler to the TextBlock--is there any way I can simply make it "transparent" to drag and drop operations?
Something that just occurred to me while writing this which does work is to put the text below the list in the Z-order and then give the list a transparent background. But is this really the right way to achieve this? Ideally, there'd be a way to give the text one ZIndex for rendering, and a different one for hit testing.
Set IsHitTestVisible to False for TextBlock.

How to check if mouse is over selected area in mschart

In my WinForms application I have Chart control with those settings:
chartArea.CursorX.IsUserEnabled = true;
chartArea.CursorX.IsUserSelectionEnabled = true;
chartArea.AxisX.ScaleView.Zoomable = false;
where chartArea is main (and only) ChartArea object in my Chart control.
What I am trying to do is posibility of selecting area (it is possible already), and when mouse is over this area, if I left click chart cotrol inside that selected area, I wan't it too zoom in.
First problem here is how to detect if I am over selected area ? with chart.HitTest() i can get HitTestResult.PointIndex field value and compare it with selection range. But this only works, if mouse is exactly over DataPoint. So it doesn't work for SeriesChartType.FastLine which I am using.
If this gets somehow solved, next will be problem with selection cancelation after mouse click (before Click or MouseXXX events are called).
SOLVED
I've found axis.PixelPositionToValue() method, which gives me every info I need, because from MouseMove event arguments I have pixel position.
For click events problem I'll write another question.
http://www.bigresource.com/VB-Using-MsChart-MouseOver-Event-to-display-the-contents-of-array-that-populated-chart-ydWJntrg8c.html
Though this is VB.NET, the concept is the same. I think.

C# Dropdown Slide Form

Is there any built-in control like a dropdown/slider? For instance, I want to display some info on dialog/control/form and inside that form there is a arrow which expands it to show more information?
alt text http://img227.imageshack.us/img227/4945/73068794.jpg
When I click the black arrow, the form should expand vertically to show more info. That's what I want to achieve. If there isn't any built-in control, can you please tell me what do I need to do to implement it myself? And how can I add a little animation when it is expanding?
Like here (when you click the menu header it doesn't expand/contract instantly rather it does little slowly, that's the kind of animation I would like to add)
This CodeProject article should help you get started.

Categories