Click here to Skip to main content
15,914,013 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Jean-Louis Leroy20-Jul-11 8:22
Jean-Louis Leroy20-Jul-11 8:22 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
SledgeHammer0120-Jul-11 8:43
SledgeHammer0120-Jul-11 8:43 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? [modified] Pin
Jean-Louis Leroy21-Jul-11 23:01
Jean-Louis Leroy21-Jul-11 23:01 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Jean-Louis Leroy21-Jul-11 23:20
Jean-Louis Leroy21-Jul-11 23:20 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Pete O'Hanlon21-Jul-11 23:29
mvePete O'Hanlon21-Jul-11 23:29 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Jean-Louis Leroy21-Jul-11 23:51
Jean-Louis Leroy21-Jul-11 23:51 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Pete O'Hanlon22-Jul-11 0:02
mvePete O'Hanlon22-Jul-11 0:02 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
SledgeHammer0122-Jul-11 6:39
SledgeHammer0122-Jul-11 6:39 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Sacha Barber22-Jul-11 11:27
Sacha Barber22-Jul-11 11:27 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
SledgeHammer0122-Jul-11 6:28
SledgeHammer0122-Jul-11 6:28 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Pete O'Hanlon21-Jul-11 23:27
mvePete O'Hanlon21-Jul-11 23:27 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
SledgeHammer0122-Jul-11 6:45
SledgeHammer0122-Jul-11 6:45 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Pete O'Hanlon22-Jul-11 9:59
mvePete O'Hanlon22-Jul-11 9:59 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
SledgeHammer0122-Jul-11 10:11
SledgeHammer0122-Jul-11 10:11 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
Pete O'Hanlon22-Jul-11 20:44
mvePete O'Hanlon22-Jul-11 20:44 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
_Maxxx_21-Jul-11 13:55
professional_Maxxx_21-Jul-11 13:55 
GeneralRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
BubingaMan25-Jul-11 1:46
BubingaMan25-Jul-11 1:46 
AnswerRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
RobCroll20-Jul-11 1:53
RobCroll20-Jul-11 1:53 
AnswerRe: MVVM: Transfering data from ViewModel to Model, when and how ? Pin
_Maxxx_21-Jul-11 14:06
professional_Maxxx_21-Jul-11 14:06 
QuestionDynamically changing themes from DLL at run-time Pin
Prasoon Chaudhary19-Jul-11 1:20
Prasoon Chaudhary19-Jul-11 1:20 
AnswerRe: Dynamically changing themes from DLL at run-time Pin
Varsha Ramnani20-Jul-11 21:23
professionalVarsha Ramnani20-Jul-11 21:23 
GeneralRe: Dynamically changing themes from DLL at run-time Pin
Prasoon Chaudhary20-Jul-11 22:42
Prasoon Chaudhary20-Jul-11 22:42 
QuestionFind an empty element in a Silverlight Grid Pin
Neo1010119-Jul-11 0:31
Neo1010119-Jul-11 0:31 
Well, I have been trying to figure this one out for three days straight and I still haven't come up with a fix.

Basically I am trying to swap out the clicked Ellipse with the only empty spot on the 3x3 checkerboard. 8 of the 9 squares are occupied. I need to find the one spot that is not occupied and I can't seem to do it. Why? Because even though there is an empty spot on the grid at runtime, Javascript refuses to acknowledge this. I used the line: var childrenCount = canvasArray[i].children.count; .. so that's all the canvases. If at runtime there is an empty spot, then how come my code refuses to see it? Or am I not writing the right code? How is the empty spot represented and found at runtime? That's what I want to know.

Here is the pseudocode:

if (squareOnGrid is empty) {
log.write(squareOnGrid + ' is empty');
emptySquare = squareOnGrid;

oldPositionBorder = sender;
oldPositionR = checkerPiece.row;
oldPositionC = checkerPiece.col;

checkerPiece.row = empty.row;
checkerPiece.column = squareOnGrid.column;

oldPositionBorder = null;
}

I want to do this with Javascript (not C#).

I already have this (Javascript):

<br />
function switchPlaces(sender) {<br />
<br />
    for (var i = 0; i < canvasArray.length; i++) {<br />
        var oldLocationBorderParent = sender;<br />
        var oldLocationCanvasParent = oldLocationBorderParent.findName('canvas' + (i + 1));<br />
        var oldLocationChild = oldLocationCanvasParent.findName('ellipse' + (i + 1));<br />
<br />
        var childrenCount = canvasArray[i].children.count;<br />
        log.info(childrenCount); //all of this outputs '1'. It should have a '0' in there, but no.<br />
<br />
        if (childrenCount == 0) {<br />
            log.info(canvasArray[i] + ' has no children');<br />
            var emptySpot = canvasArray[i];<br />
            sender['Grid.Row'] = emptySpot['Grid.Row'];<br />
            sender['Grid.Column'] = emptySpot['Grid.Column'];<br />
            oldLocationCanvasParent.children.remove(oldLocationChild);<br />
        }<br />
    }<br />
}<br />


Here is my Silverlight code:

<br />
<Grid<br />
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br />
  Loaded="onLoaded" ShowGridLines="True" Background="CornflowerBlue"><br />
<br />
    <Grid.ColumnDefinitions><br />
        <ColumnDefinition Width="100"/><br />
        <ColumnDefinition Width="100"/><br />
        <ColumnDefinition Width="100"/><br />
        <ColumnDefinition/><br />
    </Grid.ColumnDefinitions><br />
<br />
    <Grid.RowDefinitions><br />
        <RowDefinition Height="100"/><br />
        <RowDefinition Height="100"/><br />
        <RowDefinition Height="100"/><br />
    </Grid.RowDefinitions><br />
<br />
    <Border Grid.Row="0" Grid.Column="0" x:Name="b1" MouseLeftButtonUp="switchPlaces" ><br />
        <Canvas x:Name="canvas1"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse1" Fill="Red" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
    <Border Grid.Column="0" Grid.Row="1" x:Name="b2" MouseLeftButtonUp="switchPlaces"  ><br />
        <Canvas x:Name="canvas2"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse2" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
    <Border Grid.Column="0" Grid.Row="2" x:Name="b3" MouseLeftButtonUp="switchPlaces"   ><br />
        <Canvas x:Name="canvas3"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse3" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
    <Border Grid.Column="1" Grid.Row="1" x:Name="b4" MouseLeftButtonUp="switchPlaces"   ><br />
        <Canvas x:Name="canvas4"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse4" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
    <Border Grid.Column="1" Grid.Row="2" x:Name="b5" MouseLeftButtonUp="switchPlaces"   ><br />
        <Canvas x:Name="canvas5"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse5" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
    <Border Grid.Column="2" Grid.Row="0" x:Name="b6" MouseLeftButtonUp="switchPlaces"   ><br />
        <Canvas x:Name="canvas6"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse6" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
    <Border Grid.Column="2" Grid.Row="1" x:Name="b7" MouseLeftButtonUp="switchPlaces"   ><br />
        <Canvas x:Name="canvas7"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse7" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
    <Border Grid.Column="2" Grid.Row="2" x:Name="b8" MouseLeftButtonUp="switchPlaces" ><br />
        <Canvas x:Name="canvas8"><br />
            <Ellipse Width="100" Height="100" x:Name="ellipse8" Visibility="Visible"/><br />
        </Canvas><br />
    </Border><br />
<br />
</Grid><br />


If anyone has any idea how to fix this..

Thank you
QuestionRe: Find an empty element in a Silverlight Grid Pin
Mark Salsbery19-Jul-11 12:35
Mark Salsbery19-Jul-11 12:35 
QuestionEntity Framework - Sorting Relationproperties Pin
Nicolai Schrade18-Jul-11 22:52
Nicolai Schrade18-Jul-11 22:52 

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.