Telerik RadComboBox Apply SelectionBoxTemplate OnLoad?

Basically, we created our own custom MultiSelect-ComboBox using Telerik RadComboBox and SelectionBoxTemplate to create custom text when multiple items are selected.

<ucControls:MultiSelectComboBoxBase
  ... >

<ucControls:RadComboBox
    x:Name="RadCombo"
    Text=""
    Height="22"
    HorizontalContentAlignment="Left"
    HorizontalAlignment="Stretch"
    DropDownClosed="RadCombo_DropDownClosed"
    IsTextSearchEnabled="False"
    IsEnabled="{Binding IsEnabled}"
    CanAutocompleteSelectItems="False"
    CanKeyboardNavigationSelectItems="False"
    LostFocus="RadCombo_LostFocus">

    <ucControls:RadComboBox.SelectionBoxTemplate>
        <DataTemplate>
            <Grid Background="Aqua">
                <TextBlock x:Name="ComboBoxDisplay" Text="{Binding Text, ElementName=RadCombo}" />
            </Grid>
        </DataTemplate>
    </ucControls:RadComboBox.SelectionBoxTemplate>

    <ucControls:RadComboBox.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <CheckBox x:Name="chkBox"
                          Content="{Binding ItemValue}"
                          Tag="{Binding ItemID}"
                          Height="16" Margin="2"
                          IsChecked="{Binding IsChecked, Mode=TwoWay}"
                          Visibility="{Binding IsSelectAllItem, Converter={StaticResource booleanToVisibilityConverter}, ConverterParameter=NOT}"
                          HorizontalAlignment="Stretch" VerticalAlignment="Top"
                          Checked="ChkBox_Checked" Unchecked="ChkBox_Unchecked"
                          IsEnabled="{Binding IsEnabled, Mode=TwoWay}"/>

                <HyperlinkButton
                    VerticalAlignment="Center" Content="{Binding ItemValue}"
                    Visibility="{Binding IsSelectAllItem, Converter={StaticResource booleanToVisibilityConverter}}"
                    Style="{StaticResource HyperlinkButtonNoBorderStyle}" Margin="3,2,0,0"
                    Click="HyperlinkButton_Click"
                    IsEnabled="{Binding IsEnabled, Mode=TwoWay}" />
            </StackPanel>
        </DataTemplate>
    </ucControls:RadComboBox.ItemTemplate>
</ucControls:RadComboBox>

      

It works great, but the only problem is that it seems that the SelectionBoxTemplate is not actually being applied when the radcombobox is loaded. It only applies when clicking on a box.

When it loads, it displays: Then you click and displays the dropdown: Then you click and displays the correct text from the SelectionBoxTemplate:
oYLs9Yv.png

GCWhAi4.png

srIhmpX.png



Note. I made the background color of the Textblock blue to show that it is not being applied on boot.


Ideally, when it loads, it should automatically apply the SelectionBoxTemplate and display the correct information, rather than click and then click further away from the multiselectcombobox. Also, the TextBlock text is bound to the RadComboBox text because in the code behind we are setting the RadComboBox text. There is no problem with null values ​​or previously unset text, because I was looking in debug mode and all the information is there, the select box template just doesn't apply until the field gets focus.


Is there some event that needs to be fired before the template is applied, or is there a way to force the template to be applied on load?

+3
c # telerik wpf silverlight xaml


source to share


No one has answered this question yet

Check out similar questions:

4
Silverlight ValidationSummary does not store errors for ListBox items with the same name
4
How do I implement IDataErrorInfo to bind indexer strings?
1
TextBlock as CheckBox content not displaying
1
How to bind opacity of certain GridView items to dual property of Win8.1 App objects, C #
1
Go to another page IocContainers and MVVM light
0
Style binding options
0
Silverlight Combobox sets the selected item to the selected datagrid item
0
TextBox "expected DD / MM / YYYY" in WPF + MVVM + Binding + UserInput
0
combo box inside custom control disappears when styling is applied in wpf
0
WPF XAML Collect a property from a template and use it as a trigger in another template.



All Articles
Loading...
X
Show
Funny
Dev
Pics