Add View to Main User Control difficulty
Im building an extension for an app here's my problem.
There is a main Layout xaml page and this binds to the main applications
datasource(meaning you can use different layouts on the app)
I created a View that I would like to place on this layout page. My view
has its own view model which gets set once the "tool" gets clicked in the
application.
From debugging it hits my viewmodel everytime but never updates anything.
I add my view to the main layout like
<!--Begin Custom Tab Item-->
<sdk:TabItem Name="StatisticsTabItem" Cursor="Hand"
Visibility="Visible">
<Grid HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Add Stats view here-->
<views:StatisticsView x:Name="StatsView"
DataContext="{Binding
BindsDirectlyToSource=True}" Grid.Row="1"/>
</Grid>
</sdk:TabItem>
So currently It sets a label on my view everytime and set its correctly
but nothing gets updated on the actual view within the main layout xaml
I did set up my label as
private string totalPop;
public string TotalPop
{
get { return totalPop; }
set
{
if (totalPop != value)
{
totalPop = value;
OnNotifyPropertyChanged("TotalPop");
}
}
}
<sdk:Label x:Name="lbltotPop" Grid.Row="1" Grid.Column="0"
Grid.ColumnSpan="2" Content="{Binding TotalPop}" />
In my other applications it works fine but dont know how to set the
binding to my view gets updated.
No comments:
Post a Comment