Below is my XAML code, I want to get the list selection index from the ListView using SelectionChanged event. I cannot achieve this.
<Page
x:Class="MMRevamp_2016.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MMRevamp_2016"
xmlns:ViewModels="using:MMRevamp_2016.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="Gray"
FontFamily="{StaticResource ContentControlThemeFontFamily}">
<Page.Resources>
<ViewModels:HomePageViewModel x:Key="ViewModel" />
<DataTemplate x:Key="headerTemplate">
<TextBlock Text="{Binding Title}" FontSize="16"/>
</DataTemplate>
<DataTemplate x:Key="pivotTemplate">
<ListView x:Name="listView" Background="White" SelectionChanged="getIndex" ItemsSource="{Binding Articles}" HorizontalAlignment="Left" Margin="-25 0 -25 0">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Tapped="ArticleDetailStackPanel_Tapped">
<Grid>
<Image x:Name="ArticleImage" Source="{Binding ImageURL}"></Image>
<Grid>
<Border VerticalAlignment="Bottom" Height="65" Background="Black" Opacity="0.5">
</Border>
<TextBlock x:Name="HeadLine" Text="{Binding HeadLine}" VerticalAlignment="Bottom"
Margin="10 0 0 5" TextWrapping="Wrap"
FontSize="20" Foreground="White"
Pivot.SlideInAnimationGroup="GroupTwo"
FontWeight="Bold" />
</Grid>
</Grid>
<StackPanel>
<TextBlock Text="{Binding Abstract}" TextWrapping="Wrap" FontSize="15"
Pivot.SlideInAnimationGroup="GroupTwo" Margin="10 5 0 10"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</DataTemplate>
</Page.Resources>
<Grid Background="Gray">
<Grid x:Name="LoadingGrid" Visibility="Visible">
<ProgressRing x:Name="progressRing" IsActive="True" Foreground="White" HorizontalAlignment="Center" Width="60"
Height="50" VerticalAlignment="Center" Margin="0 20 0 0"></ProgressRing>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Image Source="Source" HorizontalAlignment="Center" Margin="1 5 0 0"></Image>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Button x:Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content=""
Width="60" Height="60" Background="Transparent" Margin="-10 -20 0 0"
Click="HamburgerButton_Click"/>
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="செய்திகள்" HorizontalAlignment="Center" FontSize="30"
Margin="-35 0 0 0" Foreground="White"></TextBlock>
</Grid>
</Grid>
<Grid Grid.Row="2" x:Name="ArticlesGrid" Visibility="Collapsed">
<SplitView x:Name="MySplitView" DisplayMode="CompactOverlay" IsPaneOpen="False"
CompactPaneLength="0" OpenPaneLength="220">
<SplitView.Pane>
<ListView x:Name="menuBindList" Background="Gray">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel Orientation="Horizontal" Tag="{Binding SectionName}">
<!--<Button x:Name="MenuButton1" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent" Margin="-10 0 0 0"/>-->
<TextBlock Text="{Binding TitleofAccess}"
Tag="{Binding SectionName}" FontSize="18"
VerticalAlignment="Center" Tapped="MenuTextBlock_Tapped" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</SplitView.Pane>
<SplitView.Content>
<ScrollViewer Name="articlesScroll">
<Pivot DataContext="{StaticResource ViewModel}" x:Name="pivot"
HeaderTemplate="{StaticResource headerTemplate}"
ItemTemplate="{StaticResource pivotTemplate}" ItemsSource="{Binding Feeds}" Margin="0,-10,0,10"
SelectionChanged="pivot_SelectionChanged">
</Pivot>
</ScrollViewer>
</SplitView.Content>
</SplitView>
</Grid>
</Grid>
</Grid>
</Page>
If anyone guide me to achieve this would be very helpful. Thanks in advance
In the getIndex method do this,
int selectedItemIndex = (sender as ListView).SelectedIndex;
Related
I am trying to display an selected listview item in a ContentPresenter.
The ListView is populated from the PlayersViewModel. The items presenting a PlayerViewModel.
Now I want to display the selected PlayerViewModel outside the ListView in an ContentPresenter. In the design view only the Content binded type is shown. Like: PlayersViewModel.CurrentPlayer.
How can I make the ContentPresenter work the same way as the ListView.ItemTemplate?
Thanks in advance.
<ListView ItemsSource="{x:Bind PlayersViewModel.Players}" SelectedIndex="{x:Bind PlayersViewModel.Index}" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2">
<ListView.ItemTemplate>
<DataTemplate x:DataType="viewModels:PlayerViewModel">
<Viewbox>
<StackPanel BorderBrush="Black" BorderThickness="1">
<TextBlock Text="{x:Bind Name}" />
<TextBlock Text="{x:Bind Score, Mode=TwoWay}" />
</StackPanel>
</Viewbox>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ContentPresenter Grid.Row="0" Grid.Column="1" Content="{x:Bind PlayersViewModel.CurrentPlayer}">
<ContentPresenter.Resources>
<DataTemplate x:Key="dataTemplateCurrentPlayer" x:DataType="viewModels:PlayerViewModel">
<StackPanel BorderBrush="Black" BorderThickness="1">
<TextBlock Text="{x:Bind Name}" />
<TextBlock Text="{x:Bind Score, Mode=TwoWay}" />
</StackPanel>
</DataTemplate>
</ContentPresenter.Resources>
</ContentPresenter>
<UserControl x:Class="App1.MyUserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<UserControl.Resources>
<DataTemplate x:DataType="viewModels:PlayerViewModel"
x:Key="PlayerTemplate">
<Viewbox>
<StackPanel BorderBrush="Black"
BorderThickness="1">
<TextBlock Text="{x:Bind Name}" />
<TextBlock Text="{x:Bind Score, Mode=TwoWay}" />
</StackPanel>
</Viewbox>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>
<ListView ItemsSource="{x:Bind PlayersViewModel.Players}"
SelectedIndex="{x:Bind PlayersViewModel.Index}"
ItemTemplate="{StaticResource PlayerTemplate}" />
<ContentControl Grid.Column="1"
Content="{x:Bind PlayersViewModel.CurrentPlayer}"
ContentTemplate="{StaticResource PlayerTemplate}" />
</Grid>
</UserControl>
You can use ListView Footer Template to show detailed information of selected item
<ListView ItemsSource="{x:Bind PlayersViewModel.Players}" SelectedIndex="{x:Bind PlayersViewModel.Index}" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2">
<ListView.ItemTemplate>
<DataTemplate x:DataType="viewModels:PlayerViewModel">
<Viewbox>
<StackPanel BorderBrush="Black" BorderThickness="1">
<TextBlock Text="{x:Bind Name}" />
<TextBlock Text="{x:Bind Score, Mode=TwoWay}" />
</StackPanel>
</Viewbox>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.FooterTemplate>
<DataTemplatex:DataType="viewModels:PlayerViewModel">
<StackPanel BorderBrush="Black" BorderThickness="1">
<TextBlock Text="{x:Bind PlayersViewModel.CurrentPlayer.Name}" />
<TextBlock Text="{x:Bind PlayersViewModel.CurrentPlayer.Score, Mode=TwoWay}" />
</StackPanel>
</DataTemplate>
</ListView.FooterTemplate>
</ListView>
Or other way is you can use just Stackpanel
<StackPanel BorderBrush="Black" BorderThickness="1">
<TextBlock Text="{x:Bind PlayersViewModel.CurrentPlayer.Name}" />
<TextBlock Text="{x:Bind PlayersViewModel.CurrentPlayer.Score, Mode=TwoWay}" />
</StackPanel>
Hope this works..
So I have a ScrollView with a StackPanel. Inside the StackPanel I have three ListViews with different List<object>-sources.
What I want to achieve is to disable scrolling on the ListViews and only scroll all of them in the same ScrollView.
I get something that scrolls a little bit okey when i hardcode the height of the scrollview, but if I don't do that it only snaps back to start after I release the finger. How can I achieve to get the height?
Current XAML:
<Style x:Key="ListViewHeaderDisableScroll" TargetType="ListView">
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="False" />
</Style>
<Page
x:Class="TestApp.SecondaryView.PatientDetailView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ViewModels="using:TestApp.ViewModel"
mc:Ignorable="d">
<Page.DataContext>
<ViewModels:PatientDetailViewModel />
</Page.DataContext>
<Grid Background="White">
<StackPanel Orientation="Vertical">
/* Menu-Grid*/
<ScrollViewer VerticalScrollMode="Enabled" VerticalScrollBarVisibility="Hidden" IsVerticalRailEnabled="True" Height="800">
<StackPanel Name="StackPanel_Lists">
<ListView Style="{StaticResource ListViewHeaderDisableScroll}" ItemsSource="{Binding DummyProblems}" Background="White">
<ListView.Header>
<StackPanel Style="{StaticResource ListViewHeaderStackPanel}">
<TextBlock Text="HEADER 1" FontSize="18" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
<SymbolIcon Symbol="Play" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,0,10"/>
</StackPanel>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate x:DataType="ViewModels:PatientDetailViewModel">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock FontSize="20" Grid.Row="0" Foreground="DimGray" Margin="5,5,5,5" Text="{Binding Note}"></TextBlock>
<TextBlock FontSize="15" Grid.Row="1" Foreground="DimGray" Margin="5,5,5,5" Text="{Binding Fo}"></TextBlock>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ListView Style="{StaticResource ListViewHeaderDisableScroll}" ItemsSource="{Binding DummyMeasures}" Background="White">
<ListView.Header>
<StackPanel Background="DarkGray" Orientation="Horizontal" FlowDirection="LeftToRight" Padding="8,8,8,8">
<TextBlock Text="HEADER 2" FontSize="18" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
<SymbolIcon Symbol="Play" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,0,10"/>
</StackPanel>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate x:DataType="ViewModels:PatientDetailViewModel">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock FontSize="20" Grid.Row="0" Foreground="DimGray" Margin="5,5,5,5" Text="{Binding Description}"></TextBlock>
<TextBlock FontSize="15" Grid.Row="1" Foreground="DimGray" Margin="5,5,5,5" Text="{Binding Note}"></TextBlock>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ListView Style="{StaticResource ListViewHeaderDisableScroll}" ItemsSource="{Binding DummyGoals}" Background="White">
<ListView.Header>
<StackPanel Background="DarkGray" Orientation="Horizontal" FlowDirection="LeftToRight" Padding="8,8,8,8">
<TextBlock Text="HEADER 3" FontSize="18" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"/>
<SymbolIcon Symbol="Play" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,0,10"/>
</StackPanel>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate x:DataType="ViewModels:PatientDetailViewModel">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock FontSize="20" Grid.Row="0" Foreground="DimGray" Margin="5,5,5,5" Text="{Binding Description}"></TextBlock>
<TextBlock FontSize="15" Grid.Row="1" Foreground="DimGray" Margin="5,5,5,5" Text="{Binding Fo}"></TextBlock>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</ScrollViewer>
</StackPanel>
</Grid>
So I found this:
The StackPanel outside og everything did ruin everything. I changed it to Grid and made the ScrollView *. Now everything works
My ICommand is not firing when i touch my button...
I have a DataTemplate within a DataTemplate... does DataContext still refer to the entire page or is it that DataContext refers to the previous DataTemplate and that's why it cannot find my view model's ICommand?
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel VerticalAlignment="Top">
<Border BorderThickness="0 0 0 2" BorderBrush="{StaticResource xLightGray}" Margin="0,0,0,10" Padding="0,0,0,10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Background="Transparent">
<Border Background="White" BorderThickness="0" Width="40" Height="40" HorizontalAlignment="Left">
<Image Source="{Binding image.thumbnail_link}" Width="40" Height="40"></Image>
</Border>
</StackPanel>
<StackPanel Grid.Column="1" VerticalAlignment="Center" Background="Transparent">
<TextBlock Text="{Binding name}" HorizontalAlignment="Left" FontSize="30" VerticalAlignment="Center" Padding="10,0,0,0" />
</StackPanel>
</Grid>
</Border>
<phone:LongListSelector x:Name="OrganisationItemList"
Background="Transparent"
ItemsSource="{Binding spaces}"
LayoutMode="List"
VerticalContentAlignment="Stretch">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<Button Background="Red" Style="{StaticResource xTransparentButton}" Command="{Binding Path=DataContext.LoadSpaceCommand, ElementName=SpaceList}" CommandParameter="{Binding}" Padding="0,0,0,5" Margin="0" Height="auto" BorderThickness="0" HorizontalAlignment="Left" VerticalAlignment="Stretch" HorizontalContentAlignment="Left" UseLayoutRounding="True" FontSize="0.01">
<StackPanel Grid.Column="1" VerticalAlignment="Center" Background="Transparent">
<TextBlock Padding="0,0,0,0" Text="{Binding name}" HorizontalAlignment="Left" FontSize="{StaticResource xFontSize}" />
</StackPanel>
</Button>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
Found the answer, you must set ElementName in the binding to the parent ListBox:
Command="{Binding Path=DataContext.LoadSpaceCommand, ElementName=OrganisationList}"
I am not able to make the scrollviewer working! The list is not scrollable. Maybe you can help me :)
<Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ScrollViewer Margin="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel VerticalAlignment="Top">
<ListBox x:Name="KommentareListView" ItemsSource="{Binding}" Foreground="White" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Background="#FF0083FF" Width="10" />
<StackPanel Margin="10,5,10,5" Grid.Column="1">
<TextBlock Text="{Binding Kommentar}"
FontSize="16" Margin="0,0,0,0" TextWrapping="Wrap" Foreground="Black"/>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding Author}"
FontSize="12" Margin="0,0,0,0" Foreground="Black"/>
<TextBlock Text="{Binding Date}"
FontSize="12" Margin="30,0,0,0" Foreground="Black"/>
</StackPanel>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button x:Name="mehrKommentareLaden" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,10,0,0" Height="45" Visibility="Collapsed" Content="mehr Kommentare laden" Click="mehrKommentareLaden_Click" />
</StackPanel>
</ScrollViewer>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Row="1">
<StackPanel x:Name="AnmeldenPanel" VerticalAlignment="Bottom" Width="456" Visibility="Collapsed">
<Button x:Name="AnmeldenButton" Content="Anmelden" VerticalAlignment="Center" BorderBrush="Black" Foreground="Black" Margin="0" Click="AnmeldenButton_Click"/>
<TextBlock TextWrapping="Wrap" Text="Du musst dich anmelden, um Kommentare zu verfassen." Margin="15,0,0,0"/>
</StackPanel>
<toolkit:PhoneTextBox x:Name="KommentarBox" Hint="Dein Kommentar..." LengthIndicatorVisible="True" LengthIndicatorThreshold="10" DisplayedMaxLength="240" TextWrapping="Wrap" Background="#BFB2B2B2" BorderBrush="#BFFFFFFF" Foreground="#91000000" SelectionBackground="#FF0083FF" SelectionForeground="White" Style="{StaticResource PhoneTextBoxWhiteBackground}" Height="74" Width="456"/>
</StackPanel>
<!--<Controls:WatermarkTextBox x:Name="KommentarTextBox" Margin="0,0,100,20" TextWrapping="Wrap" Watermark="Dein Kommentar...." Height="30" VerticalAlignment="Center" FontFamily="Calibri" FontSize="17.333" BorderBrush="#CC000000"/>-->
</Grid>
Try making the List height to auto and everything else to auto which is in between List and ScrollView like you are having StackPanel.
I Have Used ItemsControl and added this in wrappanel.
<toolkit:WrapPanel Height="Auto" Width="Auto" Orientation="Horizontal" >
<ItemsControl ItemsSource="{Binding ParcelViewModel.FavoriteParcelImages}" Height="Auto" Width="Auto" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Grid.Column="2" Grid.Row="1" Grid.RowSpan="3" Height="Auto" Width="Auto" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" BorderBrush="LightGray" Margin="3" Height="Auto" Width="200" >
<StackPanel Orientation="Horizontal" Width="200">
<Grid Width="200">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Height="100" HorizontalAlignment="Left">
<!--<Image Source="/PropMgmt;component/Assets/Images/office-building-icon.png" Margin="0,5,0,0" Width="50" Height="50" />-->
<Image Source="{Binding DisplayImage.Source}" Height="50" Width="50"></Image>
<StackPanel Margin="15,0,0,0">
<StackPanel Orientation="Horizontal">
<Image Source="/PropMgmt;component/Assets/Images/circle_orange.png" Width="10" />
<TextBlock Text="{Binding ReservedCount}" Margin="5,0,0,0"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Image Source="/PropMgmt;component/Assets/Images/circle_green.png" Width="10" />
<TextBlock Text="{Binding VaccantCount}" Margin="5,0,0,0"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Image Source="/PropMgmt;component/Assets/Images/circle_red.png" Width="10" />
<TextBlock Text="{Binding LeasedCount}" Margin="5,0,0,0"></TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1">
<TextBlock Text="Code:" FontWeight="Bold"></TextBlock>
<TextBlock Text="{Binding Code}"></TextBlock>
<TextBlock Text="Name:" FontWeight="Bold"></TextBlock>
<TextBlock Text="{Binding Title}"></TextBlock>
**<HyperlinkButton Content="{Binding Title}" Command="{Binding GetUnitListForParcel}" ></HyperlinkButton>**
<TextBlock Text="Year of Construction:" FontWeight="Bold"></TextBlock>
<TextBlock Text="{Binding Year_Of_Construction}"></TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</toolkit:WrapPanel>
Added Hyperlink Button Inside DataTemplate. But I Didnt Understand Why Command On HyperlinkButton Is Not working??
Please Help..
you need to change your binding:
<HyperlinkButton Content="{Binding Title}" Command="{Binding YourViewModelName.GetUnitListForParcel, Source={StaticResource Locator}}" />