wpf - Databinding to a string derived from the Count of a List -
I have I can find it this way: Where the alert is a I thought it would be a way to expose an additional string property to increase the list ???? Call it Is the preferred way of getting that effect? Ace One way to do this is to return a string which is zero and / or any other number that you want to add custom text to update the UI when there is a change in count, whenever an item is added / Alert is removed from the list, you will need to call the marked handler with the property in the list. TextBlock , I get it from the
list & lt; T & gt; . like.
& lt; TextBlockName = "tbAlerts" Text = "{Binding Path = Alert. Calculation}" / & gt;
list & lt; String & gt; , and it shows the right thing but, when the count is zero then I want to display "no alert".
CountText รข ???? Which exits the desired string, when it is zero, "no alert" can come out, and when "code> calculation == 1 is" a warning. "Will this work? < P> If I do this, then how do I get a change in count as a result of
PropertyTanged event for Code code, so that it can be updated in WPF UI?
Public Class WarningCount Converter: IValueConverter {Public Object Conver T (object value, Type type type, object parameter, Kalcrinfo culture) {string result = null; If (value! = Null) {int count = System.Convert.ToInt32 (value); If (value == 0) result = "no alert"; And result = count.ToString (); } Return results; } Public Object Convertback (type object type, type type, object parameter, culture input culture) {new naturally exposed (return); }}
& lt; UserControl.Resources & gt; & Lt; Local: AlertConverter Converter x: key = "AlertConnectConver" /> & Lt; /UserControl.Resources> & Lt; TextBlock x: Name = "tbAlerts" text = "{Biting Alert. Calculation, Converter = {Static Resources AlertConverter Converter}}" />
Comments
Post a Comment