I am using Many Data Template to load the different - different views on Run Time see below example of 1 Data template. In this i am using nested panels and containers and with in that there is a button with a Command.
In this structure when i tries to executes the command it doesn't. The control doesn't goes to command in View Model section.
But when i removed the <ScrollViewer></ScrollViewer> from above code it works fine very well, Why this is happening ???<DataTemplate x:Key="View1"><DataTemplate.Resources><ResourceDictionary Source="/Project;Component/Resource/Resource.xaml"></ResourceDictionary></DataTemplate.Resources><ScrollViewer Style="{StaticResource ScrollViewerStyle1}" VerticalScrollBarVisibility="Auto" Width="500"
Height="400" HorizontalContentAlignment="Center" VerticalAlignment="Top"><ItemsControl ItemsSource="{Binding Path=Collection}"><ItemsControl.ItemTemplate><DataTemplate><StackPanel><StackPanel.Resources><Utility:CommandParameterConverter x:Key="CommandParameterConverter"/><VM:CategoryViewModel x:Key="CategoryViewModel"/><ImageBrush x:Key="ButtonBackGroundImage"
ImageSource="/Project;component/Images/img.png"></ImageBrush></StackPanel.Resources> <Button Tag="{Binding Id}" Command="{Binding Path=CategoryCommand}"><TextBlock Text="{Binding Item}" TextWrapping="Wrap" TextAlignment="Center"/><Button.CommandParameter><MultiBinding Converter="{StaticResource CommandParameterConverter}"><Binding Path="Tag" ElementName="CategoryBtn"></Binding><Binding Path="Content" ElementName="CategoryBtn"></Binding></MultiBinding></Button.CommandParameter> </Button></StackPanel></DataTemplate></ItemsControl.ItemTemplate></ItemsControl></ScrollViewer></DataTemplate>
And how to get invoked the Command parameter of Button when the Scroll Viewer is in the Data Template ???
Thanks & Regards
Ashutosh
Ashutosh Tiwari