Click here to Skip to main content
15,890,512 members
Home / Discussions / WPF
   

WPF

 
Questionhow to generate tree view in MVVM- silverlight Pin
silverlightnewbee4-Jan-11 17:51
silverlightnewbee4-Jan-11 17:51 
AnswerRe: how to generate tree view in MVVM- silverlight Pin
Abhinav S4-Jan-11 18:30
Abhinav S4-Jan-11 18:30 
QuestionWCF Service and event [modified] Pin
CrafterIt4-Jan-11 0:03
CrafterIt4-Jan-11 0:03 
AnswerRe: WCF Service and event Pin
Abhinav S4-Jan-11 0:30
Abhinav S4-Jan-11 0:30 
GeneralRe: WCF Service and event Pin
CrafterIt4-Jan-11 2:09
CrafterIt4-Jan-11 2:09 
AnswerRe: WCF Service and event Pin
Abhinav S4-Jan-11 18:33
Abhinav S4-Jan-11 18:33 
GeneralRe: WCF Service and event Pin
CrafterIt4-Jan-11 20:39
CrafterIt4-Jan-11 20:39 
Questiontreeview- MVVM- how to fire a command on selectedItemChanged Pin
silverlightnewbee3-Jan-11 2:12
silverlightnewbee3-Jan-11 2:12 
Hi experts,

I have a small projects based on MVVM. I am using tree view control but I am unable to fire a command when a treeview node is selected. My command is declared in a ViewModel.cs file, command is defined in Command.cs file. the command is being called in XAML page. Codes from these three files are here for your ready reference. I searched web a lot, but did not overcome my problem.


XAML----------
<navigation:Page x:Class="WOManagement.Views.WOMeasurement2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlnsBig Grin | :-D ="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:my="clr-namespace:EIPControls;assembly=EIPControls"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:lc="clr-namespace:WOManagement.ViewModel"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:newcombo="clr-namespace:WOManagement.ViewModel"
Title="WOMeasurement2 Page" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
d:DesignHeight="659" d:DesignWidth="887">
<UserControl.Resources>
<lc:WOMeasViewModel x:Key="Measurement"></lc:WOMeasViewModel>

</UserControl.Resources>
<sdk:Page.Effect>
<DropShadowEffect/>
</sdk:Page.Effect>
<Grid x:Name="LayoutRoot" Width="888" Height="660" DataContext="{Binding Source={StaticResource Measurement}}" >


<sdk:TreeView Height="230" HorizontalAlignment="Left" Name="trvWOList" VerticalAlignment="Top" Width="315" Margin="5"
ItemsSource="{Binding Path=lstWODetails, Mode=TwoWay}">
<sdk:TreeView.ItemTemplate>
<sdk:HierarchicalDataTemplate ItemsSource="{Binding Path=lstItemCodesTree, Mode=TwoWay}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding strWOParent}">

</TextBlock>
<TextBlock Text="{Binding strItemCode}"></TextBlock>
<TextBlock Text="{Binding strstage}"></TextBlock>
</StackPanel>
</sdk:HierarchicalDataTemplate>
</sdk:TreeView.ItemTemplate>
</sdk:TreeView>

</Grid>
</navigation:Page>



viewModel.cs-----------------------

using System.Windows.Input;
using WOManagement.Model;
using WOManagement.Commands;
using System.Windows;

namespace WOManagement.ViewModel
{
public class WOMeasViewModel : WOMeasModel
{

public ICommand test { get { return new check(); } }


}
}


Command.cs---------------

using System;
using System.Windows;
using System.Windows.Input;
using WOManagement.ServiceReference1;
using WOManagement.ViewModel;
using System.Collections;
using System.Collections.ObjectModel;

namespace WOManagement.Commands
{
public class check : ICommand
{

public bool CanExecute(object parameter)
{
return true;
}

public event EventHandler CanExecuteChanged;

public void Execute(object parameter)
{
MessageBox.Show("hi");
}
}
}




please some one help me.
AnswerRe: treeview- MVVM- how to fire a command on selectedItemChanged Pin
silverlightnewbee3-Jan-11 2:39
silverlightnewbee3-Jan-11 2:39 
QuestionHow to create the Captcha Option in Silverlight Pin
Mayur Bheda2-Jan-11 20:07
Mayur Bheda2-Jan-11 20:07 
AnswerRe: How to create the Captcha Option in Silverlight Pin
Abhinav S2-Jan-11 20:14
Abhinav S2-Jan-11 20:14 
GeneralRe: How to create the Captcha Option in Silverlight Pin
Mayur Bheda4-Jan-11 3:33
Mayur Bheda4-Jan-11 3:33 
AnswerRe: How to create the Captcha Option in Silverlight Pin
mbcrump12-Jan-11 4:47
mentormbcrump12-Jan-11 4:47 
QuestionHow to display window at start up? Pin
Tesic Goran30-Dec-10 2:47
professionalTesic Goran30-Dec-10 2:47 
AnswerRe: How to display window at start up? Pin
Dr.Walt Fair, PE30-Dec-10 6:44
professionalDr.Walt Fair, PE30-Dec-10 6:44 
GeneralRe: How to display window at start up? Pin
Tesic Goran30-Dec-10 20:45
professionalTesic Goran30-Dec-10 20:45 
Questionwcf or windows service Pin
arkiboys30-Dec-10 2:09
arkiboys30-Dec-10 2:09 
AnswerRe: wcf or windows service Pin
#realJSOP30-Dec-10 2:36
mve#realJSOP30-Dec-10 2:36 
GeneralRe: wcf or windows service Pin
Pete O'Hanlon30-Dec-10 2:39
mvePete O'Hanlon30-Dec-10 2:39 
GeneralRe: wcf or windows service Pin
#realJSOP30-Dec-10 5:05
mve#realJSOP30-Dec-10 5:05 
GeneralRe: wcf or windows service Pin
SledgeHammer0130-Dec-10 6:28
SledgeHammer0130-Dec-10 6:28 
GeneralRe: wcf or windows service Pin
#realJSOP30-Dec-10 7:34
mve#realJSOP30-Dec-10 7:34 
GeneralRe: wcf or windows service Pin
Michael Agroskin31-Dec-10 12:46
Michael Agroskin31-Dec-10 12:46 
GeneralRe: wcf or windows service Pin
arkiboys30-Dec-10 2:56
arkiboys30-Dec-10 2:56 
GeneralRe: wcf or windows service Pin
#realJSOP30-Dec-10 5:08
mve#realJSOP30-Dec-10 5:08 

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.