Hi Every one ,
I need to pass string id from my one view model to another as i have user control and its view model separate to finish task .
Here how much i did using dependency property
public string Module
{
get { return (string)GetValue(ModuleName); }
set
{
SetValue(ModuleName, value);
}
}
public static readonly DependencyProperty ModuleName =
DependencyProperty.Register("Module", typeof(string), typeof(UcPhotos),
new PropertyMetadata(string.Empty, OnModuleNameChanged));
private static void OnModuleNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as UcPhotos).ModuleId = e.NewValue.ToString();
(d as UcPhotos).id = e.NewValue.ToString();
}
private string _ModuleId;
public string ModuleId
{
get
{ return _ModuleId; }
set
{
if (_ModuleId == value)
{
return;
}
((UcPhotoViewModel)this.DataContext).Module = value.ToString();
_ModuleId = value;
}
}
Where for user control i have property which i ll use for further . the problem is whiling sending value from my page , if it is hard coded i am avail to get . but from my page if i am binding as my requirement its not avail to set there . ie .
<uc:UcPhotos x:Name="UcPhotoGrd" PropertyId="{Binding TskHeader.tskhdrid,Source={StaticResource ViewModel}}" Module="TASK" Visibility="{Binding PhotoGridvisible,Converter={StaticResource
BoolToVisibleConverter}}"></uc:UcPhotos>
Now Task I have given hard coded which i am able to see not the binded property TskHeader.tskhdrid. Please guys help me out if you have any other approach or further suggestion.
((UcPhotoViewModel)this.DataContext).Module