Click here to Skip to main content
15,919,500 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Implementing stop functionality for downloading data from db in WPF app in MVP Pin
Christian Graus9-Sep-09 10:26
protectorChristian Graus9-Sep-09 10:26 
GeneralRe: Implementing stop functionality for downloading data from db in WPF app in MVP Pin
Krishna Aditya9-Sep-09 21:27
Krishna Aditya9-Sep-09 21:27 
GeneralRe: Implementing stop functionality for downloading data from db in WPF app in MVP Pin
Christian Graus10-Sep-09 14:30
protectorChristian Graus10-Sep-09 14:30 
Questionhow to access the layout control from view to viewmodel Pin
anandmca8-Sep-09 20:33
anandmca8-Sep-09 20:33 
AnswerRe: how to access the layout control from view to viewmodel Pin
Pete O'Hanlon8-Sep-09 21:43
mvePete O'Hanlon8-Sep-09 21:43 
Question3rd party control for wpf graphic editing Pin
xkrja7-Sep-09 23:20
xkrja7-Sep-09 23:20 
AnswerRe: 3rd party control for wpf graphic editing Pin
Richard MacCutchan8-Sep-09 1:26
mveRichard MacCutchan8-Sep-09 1:26 
GeneralRe: 3rd party control for wpf graphic editing Pin
xkrja8-Sep-09 4:04
xkrja8-Sep-09 4:04 
GeneralRe: 3rd party control for wpf graphic editing Pin
Richard MacCutchan8-Sep-09 4:48
mveRichard MacCutchan8-Sep-09 4:48 
QuestionHow to add text to the GridView in wpf? Pin
Krishna Aditya7-Sep-09 20:49
Krishna Aditya7-Sep-09 20:49 
AnswerRe: How to add text to the GridView in wpf? Pin
ABitSmart7-Sep-09 21:11
ABitSmart7-Sep-09 21:11 
GeneralRe: How to add text to the GridView in wpf? Pin
Krishna Aditya7-Sep-09 21:17
Krishna Aditya7-Sep-09 21:17 
GeneralRe: How to add text to the GridView in wpf? Pin
ABitSmart7-Sep-09 21:25
ABitSmart7-Sep-09 21:25 
GeneralRe: How to add text to the GridView in wpf? Pin
Krishna Aditya7-Sep-09 21:36
Krishna Aditya7-Sep-09 21:36 
GeneralRe: How to add text to the GridView in wpf? Pin
ABitSmart7-Sep-09 21:52
ABitSmart7-Sep-09 21:52 
GeneralRe: How to add text to the GridView in wpf? Pin
Krishna Aditya7-Sep-09 22:44
Krishna Aditya7-Sep-09 22:44 
QuestionHow to handle Refresh and Reset in WPF application in MVP application [modified] Pin
Krishna Aditya7-Sep-09 6:03
Krishna Aditya7-Sep-09 6:03 
QuestionChanging text from white to black for printing Pin
DavidRen236-Sep-09 23:10
DavidRen236-Sep-09 23:10 
AnswerRe: Changing text from white to black for printing Pin
Richard MacCutchan7-Sep-09 0:43
mveRichard MacCutchan7-Sep-09 0:43 
GeneralRe: Changing text from white to black for printing Pin
DavidRen237-Sep-09 0:59
DavidRen237-Sep-09 0:59 
GeneralRe: Changing text from white to black for printing Pin
Richard MacCutchan7-Sep-09 1:36
mveRichard MacCutchan7-Sep-09 1:36 
GeneralRe: Changing text from white to black for printing Pin
DavidRen237-Sep-09 3:30
DavidRen237-Sep-09 3:30 
GeneralRe: Changing text from white to black for printing Pin
Richard MacCutchan7-Sep-09 5:01
mveRichard MacCutchan7-Sep-09 5:01 
QuestionWPF Unit Test Problem Pin
Hauke Wittern6-Sep-09 22:59
Hauke Wittern6-Sep-09 22:59 
Hello,

I have a problem writing a unit test for a algorithm that calculates the position of some controls. The problem is that some assertions fail because setting a property does not immediately update all other Properties that depend on its value.
For example the following assertion fails (Button.Width is a DependencyProperty):
button.Width = 123;
Assert.AreEqual(123, button.ActualWidth);


This assertion fails because the layout is not immediately updated by the WPF after setting the Width Property.

My concrete scenario looks like this:
1. Set up the test with a window with some child controls
2. Simulate moving a item by the user (done with an associated AutomationPeer and a Move Method). This affects the Center property and implicitly the ActualCenter property of the item.
3. Call the Layout Algorithm that I want to test. In order to calculate the bounds of the items the Layout Algorithm uses Properties like ActualWidth, ActualHeight and ActualCenter as well as the FrameworkElement.TransformToVisual() method.
4. execute assertions that test if the Layout Algorithm works correctly.

[TestMethod()]
public void LayoutTest()
{
    // simulate user input
    ItemPeer1.Move(50, 100);

    // execute the tested method
    LayoutAlgorithm.Layout(TheScatterView); // modifies the center of some items (in this case item2 should be updated)

    // test if the layout algorithm works correctly
    Assert.AreEqual(new Point(50, 100), Item1.Center); // using ActualCenter would fail
    Assert.AreEqual(new Point(200, 100), Item2.Center); // fails.
    // ...
}


The assertions in step 4 fail because the layout algorithm (step 3) gets obsolete information about the center of the moved item. May be the algorithm works correct but I cannot test it.

How can I get this Unit Test working? Do I have to force WPF to update the layout? How?
A solution for the first example with the button might be sufficient to help me:

button.Width = 123;
DoSomethingSoThatActualWidthGetsUpdated(); // what to do here?
Assert.AreEqual(123, button.ActualWidth);

QuestionImages upload to SQL database Pin
Nekkantidivya6-Sep-09 22:06
Nekkantidivya6-Sep-09 22:06 

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.