wpf - XAML controls binding with another controls which are in datatemplate ! -


I have the following dataplatform in xaml and here I have a normal XAML in the DataApplet and Button in Textbox, which I really want Until the person does not enter anything in the text box, I want to disable the button? But it is not working I have tried the follwing code

Please see it and help me! Or tell me another way to do this!

  & lt; UserControl.Resources & gt; & Lt; Datamapplet X: Key = "DatatapplePermeter" & gt; & Lt; Stackpackel width = "170" height = "auto" margin = "5" & gt; & Lt; TextBlock Width = "160" TextAlignment = "Left" HorizontalAlignment = "Left" Height = "22" Text = "{Binding Path = Parameter Name, Mode = Dova}" /> & Lt; TextBox x: name = "txtboxParameter" width = "160" height = "22" horizontal alignment = "left" text = "{binding path = parameter value, mode = double, update resource stripper = property changes}" /> & Lt; / StackPanel & gt; & Lt; / DataTemplate & gt;   

  & lt; Button grid Rau = "6" name = "SearchSourceParamButton" Content = "Search" Vertical Element = "Lower" margin = "12, 5,92,0" height = "20" visibility = "{binding searchbusiness visibility}" command = "{Bind Search Commands} "& gt; & Lt; Button.Style & gt; & Lt; Style TargetType = "Button" & gt; & Lt; Setter Property = "Iceded" value = "true" /> & Lt; Style.Triggers & gt; & Lt; DataTrigger binding = "{binding text, X: elementname = ttboxbox parameter}" value = "" & gt; & Lt; Setter property = "iced" value = "wrong" /> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; /Button.Style> & Lt; / Button & gt;   

Thanks nallskarthi

You get it by
1) After relay command to bond button, validate "parameter value" in the canxcat representative of the command, 2) command.

Edit: Better should be the parameter value in ViewModel, but for some reason the reason that you will not do this, after that, a stable ChangeNotifyable property in VM Create, verify this in the CanExecute rep by using this property.

Enter image details here

Comments