In my WPF application im trying to visualize some temperature data. I have a list of temperatures for the 7 past days and want to make a point to point line diagram. My problem is with the different koordinatesystems and adjusting data to the grid.
XAML:
<Grid Height="167" HorizontalAlignment="Left" Margin="6,6,0,0" Name="grid1" VerticalAlignment="Bottom" Width="455" />
C# (draft):
http://pastebin.com/6UWkMFj1
scale is a global variable that changes with a slider (1-10). How to i correct my application so the line always is centered? As it is now it starts out centeded but if i crank up the slider to 3-4 the line goes up and above the applicationwindow. I also would like to use the full height of the grid window not just a small piece like images below:
http://img32.imageshack.us/i/002wtvu.jpg/
http://img691.imageshack.us/i/001tqco.jpg/
As you can see i have worked out my data so day 1 with temperature 62 F is lower then day 2 with temperature of 76 F but i have scaling issues and placementissues... could somebody straighten out my math? :-)
I don't think that drawing on a grid is a good idea... Canvas should do... give it a try. Here is a link with related stuff that might be helpful.
Related
So official documentation does not state any "default" values on this topic. I have tried with several values like 0.01, 0.1, 1 and I can't seem to get the effect where the ScrollView keeps scrolling after an user lifts a finger.
<ScrollViewer Margin="0,210,0,66" x:Name="AboutUsScrollViewer" PanningMode="VerticalOnly" PanningDeceleration="1" PanningRatio="2" VerticalScrollBarVisibility="Hidden" VerticalAlignment="Top">
<Image x:Name="AboutUsMainImage" Source="Resources\o nama.png"></Image>
</ScrollViewer>
I'm not sure if these are actually device independent units, if so, how do I find the value where I can see the desired effect?
Note: the image is tall enough so there is clearly a lot of room for scrolling, this is not an issue.
Is there a way to set a border radius on an Entry in Xamarin's XAML, or by using a custom renderer or something ?
Everything I've tried up to now has no effect, but for my application it would be really better if I had round borders.
Thank you in advance for your answer !
PS : I've checked this post but I've not found my answer there :)
I've posted this answer here too, but for convenience I'll just paste it below:
I'm not sure if there's something wrong with this approach or not, because it seems so simple but no one's suggesting it.
But I don't see why you can't just use a Frame with IsClippedToBounds set to true. That gives you a built-in corner radius, which you can then adjust as needed.
<Grid>
<Frame
CornerRadius ="20"
IsClippedToBounds="true">
<Editor />
</Frame>
</Grid>
I'm currently using this solution and it works for me.
I think you can use a grid with 1 row and 1 column
Inside the grid you can add your Entry and, for example, this control, in the same (the only) cell. You should have an Entry with rounded corners...
This is another useful control (XFShape). Create shapes content views from shared code for your mobile apps! For Android and iOS.
I have a MVVM wpf application with a chartplotter. I have 2 vertical axis and 2 graphs (for example current and voltage over time on one chart).
<d3:ChartPlotter>
<d3:ChartPlotter.Children>
<d3:VerticalIntegerAxis/>
<d3:LineGraph DataSource="{Binding GraphOneDataSource}" Stroke="Blue"/>
<d3:LineGraph DataSource="{Binding GraphTwoDataSource}" Stroke="Red"/>
</d3:ChartPlotter.Children>
</d3:ChartPlotter>
The 2 graphs are scaled differently. I have made one graph scalable with the other by adjusting his mapping like so
GraphTwoDataSource.SetXYMapping(p=>new Point(p.X+1,((p.Y)*(GraphOneMax-GraphOneMin)/(GraphTwoMax-GraphTwoMin))));
The graphs scale with each other. The first graph values are from 1000 to 5000 and the second one's values are 10-50.
I need to adjust the second vertical axis of the chartplotter accordingly. How can you change the behaviour of the axis tick generation so that it scales with the first axis the same way as the graphs scale with each other?
as described here and here you can use InjectedPlotter . here i found an example.
Solved this problem with the DependentPlotter control introduced in the "Future of D3" library
I Need to crop and resize an Image in my WPF application as soon as the Picture is loaded.
So, my Basic Image has a VGA size (640x480), and I Need to crop the edges (top by 18 Pixels, bottom by 36 Pixels, left by 48 Pixels, and right by 24 pixels). The new image (which is 568 x 426 pixels) Need to be refitted into the original size (640 x 480 pixels) - basically it's like a digital zoomc that we're using in photography.
I've already found some sample code (Cropping whitespace from image in C#) - this is however a Little bit too complicated since I don't Need to detect the Whitespace on the image. Is there any simple algorithm just by using XAML to do this ?
Thanks in advance.
I think that you should be able to do that by using the Viewbox Class. From the linked page: Defines a content decorator that can stretch and scale a single child to fill the available space. You literally add one to your Window and set your Image as the contents and then you can set properties to control which part of the image it displays:
<ViewBox Width="500" Height="500" Stretch="Uniform">
<Image Source="Images/SomeImage.jpg" Width="300" Height="300"
Margin="-48,-18,-36,-24" />
</ViewBox>
Experiment with the different StretchDirection values and set the Margin to negative values to crop. There are examples in the linked page, but let me know if you need more help.
Hi have the following piece of XAML
<Path Stroke="#FF000000" StrokeThickness="3" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeLineJoin="Round" StrokeMiterLimit="4" Name="kvg_0994c_s1">
<Path.Data>
<PathGeometry FillRule="Nonzero" Figures="M28.27,12.64C28.32,13.27 28.52,14.32 28.17,15.16 25.86,20.7 19.22,31.55 9.81,39.71" />
</Path.Data>
</Path>
I wish to animate the PathGemorty to reveal itself slowly (over 2 seconds or so). Basically the effect that I am after is drawing a line on the screen automatically, in particular the path that is specified in the code above.
I need to do this in C# code as I am loading the XAML dynamically from an external file. Any help would be greatly appreciated.
You must use WPF animation for it. Look here: http://msdn.microsoft.com/en-us/library/ms752312.aspx More information about animation you can find in excellent book "Windows Presentation Foundation Unleashed" by Adam Nathan.
I think you can find exact answer on your question here: http://social.msdn.microsoft.com/Forums/en/wpf/thread/19a7bd4b-cf28-4b31-a329-a5f58b9ec374
what do you mean by 'reveal itself slowly' ? You mean like it was drawn bit by bit ? Then you'll have to decompose the Data, then re-compose a geometry adding elements one by one. So you might, using the Path's name (kvg_0994c_s1) in code behind, (and assuming the Path.Data is always a PathGeometry, so you can cast it to PathGeometry) you get the PathGeometry.Figures in an initial List, then clear the figures in the displayed Path. Then you set-up a timer (a DispatchTimer might be enough) to call a function every 200ms or so and in this function you add one by one the figures to the PathGeometry.Figures of the displayed path. You might have to adjust both the number of parts you add each time, and timer values to get the effect you want. And if you want constant 'speed' -> you have to compute the length of each part and adjust. But it might be nice to have non-constant speed to look more like hand-drawing.