Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
get XamCheckEditor from LabelPresenterStyle
posted

I set LabelPresenterStyle  by GetCheckBoxStyle:

Me.FieldLayouts(index).Fields(Me.FieldItem(j).Name).Settings.LabelPresenterStyle = GetCheckBoxStyle()

there is a XamCheckEditor in LabelPresenterStyle   named "ck_all_none" ,how can i get the "ck_all_none" when i want to set it's value by a button in form.

 

   Private Function GetCheckBoxStyle(Optional ByRef isChecked As Boolean = False) As Style
 
            Dim chkBox As New FrameworkElementFactory(GetType(XamCheckEditor))

            chkBox.SetValue(XamCheckEditor.HorizontalAlignmentProperty, Windows.HorizontalAlignment.Center)
            chkBox.SetValue(XamCheckEditor.NameProperty, "ck_all_none")
            chkBox.SetValue(XamCheckEditor.ValueProperty, isChecked)
            chkBox.SetValue(XamCheckEditor.VerticalAlignmentProperty, Windows.VerticalAlignment.Top)
            chkBox.AddHandler(XamCheckEditor.ValueChangedEvent, New RoutedPropertyChangedEventHandler(Of Object)(AddressOf SetChecked))

            Dim _Style As New Style(GetType(LabelPresenter))
            Dim dt As New DataTemplate(GetType(LabelPresenter))
            Dim root As New FrameworkElementFactory(GetType(DockPanel))
            root.Name = "DockPanel"
            root.AppendChild(chkBox)
            dt.VisualTree = root

            _Style.Setters.Add(New Setter(LabelPresenter.ContentTemplateProperty, dt))

              Return _Style

        End Function