Hi
When I run following code textblock is not changing.
My guess is databinding is missing either in code or XMAL.
XAML
<Window.Resources>
<ObjectDataProvider x:Key="PersonObj" ObjectType="{x:Type local:Person}" MethodName="GetFirstName" />
</Window.Resources>
<Grid>
<!--<TextBlock Margin="26,7,12,0" Name="myTextBlock" Text="{Binding Path=FirstName}" Height="69" VerticalAlignment="Top" />-->
<TextBlock Margin="26,7,12,0" Name="myTextBlock" Text="{Binding FirstName, Source={StaticResource PersonObj}}" Height="69" VerticalAlignment="Top" />
</Grid>
</Window>
CODE
namespace WpfApplication1
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
test t = new test();
}
public void testing()
{
test t = new test();
}
}
public class Person
{
public String FirstName { get; set; }
public String LastName { get; set; }
public string GetFirstName()
{
return FirstName;
}
}
}
namespace WpfApplication1
{
class test : Person
{
public test()
{
this.FirstName = "John";
this.LastName = "S";
this.GetFirstName();
}
}
}
Thanks