Hi
Our application's main window contain XamDataGrid.
We want to add Zoom-in/out capablities (Same as Excel Zooom-in/out capablities )because our grid has alot of columns , and the users want to see all of them . The numbers of rows that are shown while zooming is less relevant.
Do The XamDataGrid has this capablitiels?
If not can u had a piece of code that will show how it can be done?
Thank You
Hello,
You can define a Style for the XamDataGrid in the app.xaml Resources and add an EventSetter for the PreviewMouseWheel event. This way the Style will apply to all XDG in the Project. Also if you use Themes you can create the handler like this:
static App()
{
EventManager.RegisterClassHandler(typeof(DataPresenterBase), UIElement.PreviewMouseWheelEvent, new MouseWheelEventHandler(OnDataPresenterPreviewMouseWheel));
}
private static void OnDataPresenterPreviewMouseWheel(object sender, MouseWheelEventArgs e)
var dp = sender as DataPresenterBase;
/// do the zoom
Hope this helps you.
hello Stefan... i was just looking the application and really its very nice.great job done.But small clarification in that.in my project i ma using around 50 to 60 xamdatagrid and i should this function PreviewMouseWheel="ScrollViewer_PreviewMouseWheel" every where in my grid.It will reduce my product performance.Can i able to call one class can i use.Plz solve this problem.I am eagerly waiting to this feature to my product.
Thanks a lot Stefan!,
This really solves the problem. However instead of using ScrollViewer using a simple Grid fixes the issue better as you can even see the hidden rows, scrolling is anyways done by the xamdatagrid.
Thanks !Anindya
Hello Anindya,
I have modified the sample Ekaterina uploaded, so now it has the functionality you want. Basically instead of RenderTransform I used LayoutTransform.
Hi Ekaterina,
Above solution does not make more columns/rows visible when you zoom out. The reason for zooming is to see more columns or rows and not not see the font reduced. This is easily accomplished in the .Net 4.0 Datagrid. Its very important I implement it using Infragistics. Is this possible ? If so pls provide an example. i tried reducing font , but it looks ugly and row heights have to be reduced using binding or programmatically, which is pretty messy.
Thanks
Anindya