Click here to Skip to main content
15,894,343 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Custom markup extensions in the VS wpf designer Pin
jamie55022-Dec-08 15:16
jamie55022-Dec-08 15:16 
GeneralRe: Custom markup extensions in the VS wpf designer Pin
Mark Salsbery23-Dec-08 6:00
Mark Salsbery23-Dec-08 6:00 
QuestionBound ItemsControl doesn't refresh upon restoring a minimized window Pin
Steve McMohan18-Dec-08 11:25
Steve McMohan18-Dec-08 11:25 
AnswerRe: Bound ItemsControl doesn't refresh upon restoring a minimized window Pin
cechode18-Dec-08 13:30
cechode18-Dec-08 13:30 
GeneralRe: Bound ItemsControl doesn't refresh upon restoring a minimized window Pin
Steve McMohan22-Dec-08 1:40
Steve McMohan22-Dec-08 1:40 
GeneralRe: Bound ItemsControl doesn't refresh upon restoring a minimized window Pin
Steve McMohan22-Dec-08 19:34
Steve McMohan22-Dec-08 19:34 
QuestionSilverlight Spreadsheet Pin
Alixer18-Dec-08 6:09
Alixer18-Dec-08 6:09 
QuestionSlower WPF Performance after a button gets focus Pin
Qwentin18-Dec-08 2:29
Qwentin18-Dec-08 2:29 
Hi all!

Could you please help me with my problem. I am writing an app that allows users to drag controls over a canvas and have met the following strange behaviour: wpf performance slowsdowns as soon as a button on a form receives focus. This is so strange to me. I've posted a code of a sample app, please try to click on a red rectangle, and move the mouse holding left button. You should see that rectangle follows the cursor pretty fast. But if you click (or even press Tab to give the button a focus) and try to drag the rectangle again - you will see that now rectangle is not as fast as before.. The recrangle will be still slow if you click Tab again and give focus to the textbox.

Do you know why it happens and how I can avoid it?

<Window x:Class="ButtonSpeedTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="627" Width="580">
<Canvas Background="Wheat" MouseMove="MyMouseMove">
<Button Canvas.Left="30" Canvas.Top="30" Height="37" HorizontalAlignment="Left" Name="button1" VerticalAlignment="Top" Width="66">Button</Button>
<Rectangle MouseDown="MyMouseDown" MouseUp="MyMouseUp" MouseMove="MyMouseMove" Name="rect" Canvas.Left="100" Canvas.Top="100" Fill="Red" Stroke="Black" Width="70" Height="50" />
<TextBox Canvas.Left="246" Canvas.Top="37.52" Height="23" Name="textBox1" Width="120" />
</Canvas>
</Window>




using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace ButtonSpeedTest
{
public partial class Window1 : Window
{
bool isDragging;

public Window1()
{
InitializeComponent();
}

private void MyMouseDown(object sender, MouseButtonEventArgs e)
{
isDragging = true;
}

private void MyMouseUp(object sender, MouseButtonEventArgs e)
{
isDragging = false;
}

private void MyMouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
Point position = e.GetPosition(this);

rect.SetValue(Canvas.LeftProperty, position.X - rect.Width / 2);
rect.SetValue(Canvas.TopProperty, position.Y - rect.Height / 4);
}
}
}
}




Thanks,
Sergey.
AnswerRe: Slower WPF Performance after a button gets focus Pin
Mark Salsbery18-Dec-08 8:15
Mark Salsbery18-Dec-08 8:15 
GeneralRe: Slower WPF Performance after a button gets focus Pin
Qwentin18-Dec-08 22:05
Qwentin18-Dec-08 22:05 
GeneralRe: Slower WPF Performance after a button gets focus Pin
Mark Salsbery19-Dec-08 4:52
Mark Salsbery19-Dec-08 4:52 
GeneralRe: Slower WPF Performance after a button gets focus Pin
Jammer19-Dec-08 0:19
Jammer19-Dec-08 0:19 
QuestionPrint in WPF Pin
VisualLive17-Dec-08 17:40
VisualLive17-Dec-08 17:40 
AnswerRe: Print in WPF Pin
Fabio V Silva17-Dec-08 23:43
Fabio V Silva17-Dec-08 23:43 
AnswerRe: Print in WPF Pin
elektrowolf18-Dec-08 1:05
elektrowolf18-Dec-08 1:05 
AnswerRe: Print in WPF Pin
Thomas Stockwell22-Dec-08 6:28
professionalThomas Stockwell22-Dec-08 6:28 
QuestionWPF & DELL Tablet PC Pin
Jammer17-Dec-08 7:01
Jammer17-Dec-08 7:01 
QuestionWPF Databinding : Cannot bind data Pin
Arijit Manna17-Dec-08 2:59
Arijit Manna17-Dec-08 2:59 
AnswerRe: WPF Databinding : Cannot bind data Pin
Mark Salsbery17-Dec-08 6:33
Mark Salsbery17-Dec-08 6:33 
GeneralRe: WPF Databinding : Cannot bind data Pin
Arijit Manna17-Dec-08 18:50
Arijit Manna17-Dec-08 18:50 
GeneralRe: WPF Databinding : Cannot bind data Pin
Arijit Manna17-Dec-08 18:51
Arijit Manna17-Dec-08 18:51 
GeneralRe: WPF Databinding : Cannot bind data Pin
Mark Salsbery18-Dec-08 8:16
Mark Salsbery18-Dec-08 8:16 
QuestionHow to binding to the actual width and height of the control in doubleanimation? Pin
Eric Vonjacson16-Dec-08 23:20
Eric Vonjacson16-Dec-08 23:20 
AnswerRe: How to binding to the actual width and height of the control in doubleanimation? Pin
Pete O'Hanlon17-Dec-08 3:41
mvePete O'Hanlon17-Dec-08 3:41 
GeneralRe: How to binding to the actual width and height of the control in doubleanimation? Pin
Eric Vonjacson17-Dec-08 18:54
Eric Vonjacson17-Dec-08 18:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.