data binding - How do I access elements within a WPF window to alter them? -
i have wpf window has 2 elements. mediaelement , textblock. want access textblock either change text or toggle visibility. want code. there anyway accomplish other dependency properties , data binding? i've spent hours looking @ dependency properties , data binding , can't wrap head around them or example shows binding other xaml elements. databinding in regards complex , i'm still pretty new @ this.
well, can give name textblock , manipulate code-behind of window:
<textblock x:name="mytextblock" .../>
mywindow.xaml.cs:
private void someeventhandler(object sender, eventargs e) { mytextblock.text = "foo"; mytextblock.visibility = visibility.visible; }
Comments
Post a Comment