wpf - Data binding custom control with parent -
I have a UserControl that has listboxes.
On the original window, I have this user control and a button.
Ideally I want to use the ChangePropertyAction behavior on the parent button, and it lists the number of UserControl in the Countback
The idea is that if the user controls the list box If there is no entry in, the button is hidden on the parent window. Listback is bound to an observational label.
Can I make a dependency property to do this? I'm not sure how to calculate the listbox on this property. I
Thank you for any insights correctly in order to do this. ListBox
You can force access to
state ElementName
From button
Then you want to use BooleanToVisibilityConverter
to spell.
Do this:
& lt; Window x: orbit = "NestedTreatWindow1" Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx / 2006 / xaml "title =" window1 "height =" 200 "width =" 300 "& gt; & Lt; Window.Resources & gt; & Lt; BooleanToVisibilityConverter x: key = "boolToVisibilityConverter" /> & Lt; /Window.Resources> & Lt; StackPanel & gt; & Lt; Button visibility = "{binding element name = myList, path = HasItems, converter = {StaticResource boolToVisibilityConverter}}" & gt; Text & lt; / Button & gt; & Lt; List box x: name = "myList" & gt; & Lt ;! - & lt; ListBoxItem & gt; Item A & lt; / ListBoxItem & gt; - & gt; & Lt; / ListBox & gt; & Lt; / StackPanel & gt; & Lt; / Window & gt;
To make it work, ListBoxItems
comment, or cancel comment ...
Comments
Post a Comment