Search Results

Search found 2 results on 1 pages for 'zunyite'.

Page 1/1 | 1 

  • How to disable scrolling in ScrollViewer while Ctrl is pressed

    - by zunyite
    I'd like to implement zoom function while Ctrl key is pressed. But the MouseWheel event is not trigger while the mouse is over the ScrollView. Is there any way to do it? ps:SilverLight 4.0 <UserControl x:Class="SilverlightApplication11.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <ScrollViewer Background="Gray" MouseWheel="ScrollViewer_MouseWheel" x:Name="scrollViewer"> <Rectangle Width="200" Height="2000" MouseWheel="ScrollViewer_MouseWheel" Fill="AliceBlue" /> </ScrollViewer> </Grid> private void ScrollViewer_MouseWheel(object sender, MouseWheelEventArgs e) { if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control)) { zoom+=0.1; e.Handled = true; } }

    Read the article

  • [WPF] The calling thread cannot access this object because a different thread owns it.

    - by zunyite
    Why I can't create CroppedBitmap in the following code ? I got an exception : The calling thread cannot access this object because a different thread owns it. public MainWindow() { InitializeComponent(); ThreadPool.QueueUserWorkItem((o) => { //load a large image file var bf = BitmapFrame.Create( new Uri("D:\\1172735642.jpg"), BitmapCreateOptions.DelayCreation | BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.None); bf.Freeze(); Dispatcher.BeginInvoke( new Action(() => { CroppedBitmap cb = new CroppedBitmap(bf, new Int32Rect(1,1,5,5)); cb.Freeze(); //set Image's source to cb.... }), System.Windows.Threading.DispatcherPriority.ApplicationIdle); } ); }

    Read the article

1