How can I automatically control the transition of a Xamarin Form Carrousel that looks like a stock price presentation? - xamarin

I would like to control the speed and direction of the slide's transitions in a Carousel view. I can automatially make the slides transitions but I don't know how to control its speed nor the direction of the transition (Right to Left).
Any idea?
thanks in advance
I Start a timer to scroll each page :
public ItemsPage()
{
InitializeComponent();
_timer = new System.Timers.Timer();
_timer.Interval = 15000;
_timer.Elapsed += _timer_Elapsed;
_timer.Enabled = true;
}
After the time expires I set the new page:
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
System.Console.WriteLine("{0} Position.", Position);
Position = Position + 1;
Position = Position % Carousel_Mycloset.Count;
OnPropertyChanged("Position");
}
The pages are scroll but I cannot control the speed and direction (right to left) of the transition.

Related

Label is not show in print

I have used below code to print the Panel of windows form.
private void button1_Click(object sender, EventArgs e)
{
System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument();
doc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(Doc_PrintPage);
doc.Print();
}
private void Doc_PrintPage(object sender, PrintPageEventArgs e)
{
Panel grd = new Panel();
Bitmap bmp = new Bitmap(panel2.Width, panel2.Height, panel2.CreateGraphics());
panel2.DrawToBitmap(bmp, new Rectangle(0, 0, panel2.Width, panel2.Height));
RectangleF bounds = e.PageSettings.PrintableArea;
float factor = ((float)bmp.Height / (float)bmp.Width);
e.Graphics.DrawImage(bmp, bounds.Left, bounds.Top, bounds.Width, factor * bounds.Width);
bmp.Save("test12.jpg");
}
Now from above code, when i click on button the print function will be call but it excluded label in it. i am attaching image for your reference. first image is my UI design. , when i use print functionality it removes the label value as you can see in other image. i have used rectagleshap control which are in Pink color and i am displaying label on it. I think the label may be send back but when i used front back then also it is not appear.
Can you just try this one here i was using this for capture the whole screen which ever is active window its like screencapture or screenshot.
private void Doc_PrintPage(object sender, PrintPageEventArgs e)
{
Bitmap bitmap = new Bitmap(panel2.Width, panel2.Height);
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.InterpolationMode = InterpolationMode.Default;
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
bitmap.Save(pathDownload + filename + ".jpeg", ImageFormat.Jpeg);
bmp.Save("test12.jpg");
}
In my case label was shown back to the rectangle, so i added one more label and set it as bring front. thanks for the help.

Telerik GanttView Timeline GUI - modification

i want to change the behavior of my Telerik GanttView TimeLineContainer. The problem is, when i load data into GanttView with long duration (years) the TimeLine scales very bad. That means that it zooms in and not like I would have to zoom out.
So in best case I would like to have the TimeLine scrollbar so that the user can adjust the size on runtime.
So far I tried this, but it doesnt scales right.
this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineContainer.StretchHorizontally = false;
this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineContainer.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.FitToAvailableSize;
Solved this by adding a RadTrackBar:
private void radTrackBar_ValueChanged(object sender, EventArgs e)
{
int zoomfaktor = 10;
double value = 51 + zoomfaktor * Math.Pow(this.radTrackBarZoom.Value, 2d);
Console.WriteLine(string.Format("{0} - {1}", this.radTrackBarZoom.Value, value));
TimeSpan time = new TimeSpan(0, (int)value, 0); this.radGanttView.GanttViewElement.GraphicalViewElement.OnePixelTime = time;
this.radGanttView.GanttViewElement.GraphicalViewElement.OnePixelTime = time;
}

Detect x & y touch event in WP7 screen

I am really need help with return the coordinates x and y in the WP7 screen.
this code help me to move an rectangle in the screen with showing the start(x&y), delta(x,y) and end(x,y) :
TransformGroup transformG;
TranslateTransform translation;
// Constructor
public MainPage()
{
InitializeComponent();
this.ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(MainPage_ManipulationDelta);
transformG = new TransformGroup();
translation = new TranslateTransform();
transformG.Children.Add(translation);
rectangle.RenderTransform = transformG;
}
void MainPage_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
startX.Text =e.ManipulationOrigin.X.ToString();
startY.Text = e.ManipulationOrigin.Y.ToString();
DeltaX.Text = e.DeltaManipulation.Translation.X.ToString();
DeltaY.Text = e.DeltaManipulation.Translation.Y.ToString();
translation.X += e.DeltaManipulation.Translation.X;
translation.Y += e.DeltaManipulation.Translation.Y;
EndX.Text =Convert.ToString(translation.X);
EndY.Text = Convert.ToString(translation.Y);
}
I just want to do something like that but without move anything, just tap in the screen and know the start and the end with delta (difference).
I use silverlight
You Should remove rectangle.RenderTransform = transformG; than the rectangle should stay on the same place.

Windows 7 Auto Size on mouse left?

I was wondering on windows 7 there is the function that when your mouse hits the form left/right top it will auto size the window to half the screen. I am trying to do that with my MDI Child. Here is the code that I have, however the function does not work.
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
Form1 f1 = new Form1();
if (e.X == f1.Width/2 - 30)
{
Form activeChild = this.ActiveMdiChild;
activeChild.Width = this.Width / 2;
activeChild.Height = this.Height;
activeChild.Dock = DockStyle.Left;
}
}
You might try doing that on the Move event of the actual child form. Handling the event based on a new instance of Form1 in any event won't work very well. Anyhow, here's some code as it would look inside the child. (Ugly, but it at least does something.)
private void SubForm_Move(object sender, EventArgs e)
{
if (Location.X <= 0)
{
Width = MdiParent.Width / 2;
Height = MdiParent.Height;
Location = new Point(0,0);
Dock = DockStyle.Left;
}
}

Cancel touches events on Windows Phone

I have a list on images in a Pivot control. If you touch an image, it navigates to another view. If if flick through a new pivot and touch the image meanwhile, it navigates.
I noticed the Facebook app or the native photo albums don't have this bug.
Any idea ?
edit: the code :
Image img = new Image();
Delay.LowProfileImageLoader.SetUriSource(img, new Uri(adViewModel.Photos[k].ThbUrl));
img.Width = 150;
img.Tag = k;
img.Height = 150;
img.MouseLeftButtonDown += new MouseButtonEventHandler(launch_Diapo);
Grid.SetRow(img, i);
Grid.SetColumn(img, j);
PhotosGrid.Children.Add(img);
If you can show your code we can probably provide a more specific answer.
However:
I'm guessing you're using MouseButtonLeftDown or similar to detect the touching of the image. Rather than this, use the Tap gesture from the toolkit. This should prevent the issue you're having.
There is a possible alternative to disable the pivot gesture while you're touching the image, but depending on how you're using the image within the pivotItem this may end up preventing proper pivot navigation.
You can add the Tap event in code like this:
var gl = GestureService.GetGestureListener(img);
gl.Tap += new EventHandler<GestureEventArgs>(gl_Tap);
and the handler would be something like this. (but actually doing something useful-obviously.)
void gl_Tap(object sender, GestureEventArgs e)
{
MessageBox.Show("tapped");
}
Even I had a similar problem . What i did is ,check for MouseButtonLeftDown position and MouseButtonLeftUp position .If they are Equal navigate else do nothing .I will paste the code below.
Point temp;
void img_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
temp = e.GetPosition(null);
}
void img_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Point point = e.GetPosition(null);
if (point == temp)
{
this.NavigationService.Navigate(new Uri(...));
}
}

Resources