windows phone 8 - how to Add custom Convention for caliburn.micro? -
In my project, I need to force the visibility of the UI element for the bool property, as you know that caliburn Conference "CanName" in .micro, that's why I think adding my own custom conference. Then I found the Autobinding with the naming I add this code to my project in this project [Visibility, but this does not work and the conference "CanName" also does not work
ConventionManager.AddElementConvention & LT; FrameworkElement & gt; (Control Visibility Property, "Visibility", "Invisible"); Var baseBindProperties = ViewModelBinder.BindProperties; SeeModelBandar BindProperties = (Framework Illustrations, See Modell) = & gt; {BinduismiTiperties (framework notices, visual model); Return basebind properties (framework elements, see modell); }; Fixed zero BindVisiblityProperties (IEnumerable & lt; Framework Element & gt; Item, Type View Model) {foreach (Framework element element in item) {string PropertyName = element.Name + "isvisible"; Var Properties = viewModel.GetPropertyCaseInsensitive (Property Name); If (property! = Null) {var conference = convention manager. Getlement Convention (Framework Element); Convention Manager. Type the matching bandwidth overview (see Modell, Property Name, Property, Element, Convention, Convention, Gatebandband property (element)); }}}
Does anyone know what's wrong with this code?
I am using this convention in my project without any issue here is a rehearsal:
Private Static Zero AddCustomConventions () {Convention Manager. Adelment Convention & Lt; Framework Element & gt; (Control Visibility Property, "Visibility", "Invisible"); Var baseBindProperties = ViewModelBinder.BindProperties; SeeModelBandar BindProperties = (Framework Illustrations, See Modell) = & gt; {BinduismiTiperties (framework notices, visual model); Return basebind properties (framework elements, see modell); }; }
and your subsidiary method:
Private static zero BindVisiblityProperties (IEnumerable & LT; FrameworkElement & gt; Items, Type ViewModel) {foreach (in items FrameworkElement element) {String PropertyName = element.Name + "iswisible"; Var Properties = viewModel.GetPropertyCaseInsensitive (Property Name); If (property! = Null) {var conference = convention manager. Getlement Convention (Framework Element); Convention Manager. Type the matching bandwidth overview (see Modell, Property Name, Property, Element, Convention, Convention, Gatebandband property (element)); You can place a place in your control and a x: name
& lt; StackPanel Orientation = "Horizontal" horizontal align = "center" & gt; & Lt; Button x: name = "start recording" & gt; Start & lt; / Button & gt; & Lt; Button x: name = "stoprecord" & gt; Stop & lt; / Button & gt; & Lt; Button x: name = "foo" & gt; Foo & lt; / Button & gt; & Lt; Button x: name = "bar" & gt; Bar & lt; / Button & gt; & Lt; / StackPanel & gt; Within your
PageViewModel.cs
you can put public property
type bool
with suffix Isvisible
Public Bull FooIsVisible {Get {Back Truth; }} Public Bull Bar Receive {Visible {return false}; }}
Comments
Post a Comment