Telerik Forums
UI for WPF Forum
1 answer
70 views

Hello,

 

I need some advice about RadAutoCompleteBox.

When I click on RadAutoCompleteBox I want to see all possible results and then I will have a option to choose whether I want to select from them or start searching by typing.  Searching for text and then selecting works fine, but unfortunately searching with nothing in it doesn't work. When I click on RadAutoCompleteBox all the results are displayed, but I can't select anything from them until I type something. The hover selection works fine, I just can't select anything if RadAutoCompleteBox.SearchText is empty. Could you help me how to solve this? Thank you very much.

I am sending part of my the source code and example (WpfApp1.zip) where it also not working.


... 
 <controls:RadAutoCompleteBoxFilter x:Key="RadAutoCompleteBoxFilter" />
...
     <telerik:RadAutoCompleteBox Grid.Row="0"
                      x:Name="CaseAutoCompleteBox"
                      WatermarkContent="{x:Static rs:ResourceText.Start_Typing}"
                      ItemsSource="{Binding Suggestions}"
                      SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                      TextSearchMode="Contains"
                      TextSearchPath="Name"
                      DisplayMemberPath="Name"
                      AutoCompleteMode="SuggestAppend"
                      DropDownItemTemplate="{StaticResource CasesSearchAutoComplete}"
                      SelectionMode="Single"
                      SelectionChanged="CaseAutoCompleteBoxSelectionChanged"
                      PreviewMouseLeftButtonDown="OnPreviewMouseLeftButtonDown"
                      GotFocus="CaseAutoCompleteBox_OnGotFocus"
                      FilteringBehavior="{StaticResource RadAutoCompleteBoxFilter}"
                    
                      />



 public partial class AddMediaToCase 
 {
     public AddMediaToCase()
     {
         InitializeComponent();
         RadWindowInteropHelper.SetShowInTaskbar(this, true);
     }

     private void CaseAutoCompleteBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
     {
         var autoCompleteBox = sender as RadAutoCompleteBox;
         CaseInformationStackPanel.Visibility = autoCompleteBox.SelectedItem != null ? Visibility.Visible : Visibility.Collapsed;
     }

     private void OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
     {

         if (string.IsNullOrWhiteSpace(CaseAutoCompleteBox.SearchText))
         {
             CaseAutoCompleteBox.Populate(" ");
             
         }


     }

     private void CaseAutoCompleteBox_OnGotFocus(object sender, RoutedEventArgs e)
     {
         if (string.IsNullOrWhiteSpace(CaseAutoCompleteBox.SearchText))
         {
             
             CaseAutoCompleteBox.Populate(" ");
         }

     }
 }


  public class RadAutoCompleteBoxFilter : FilteringBehavior
  {
      public override IEnumerable<object> FindMatchingItems(string searchText, IList items,
          IEnumerable<object> escapedItems, string textSearchPath,
          TextSearchMode textSearchMode)
      {
          var result =
              base.FindMatchingItems(searchText, items, escapedItems, textSearchPath, textSearchMode) as
                  IEnumerable<object>;

          if (string.IsNullOrEmpty(searchText) || !result.Any())
          {
              return ((IEnumerable<object>)items).Where(x => !escapedItems.Contains(x));
          }

          return result;
      }
  }


 

Martin Ivanov
Telerik team
 answered on 30 Jul 2024
1 answer
37 views
I am using the RadAutoCompleteBox control in a WPF application and need assistance with configuring it to search for items based on the Name property, but display the values from the Key property.
Stenly
Telerik team
 answered on 05 Jun 2024
1 answer
65 views
Dear All,

I am using the RadAutoCompleteBox as follows. I would like to display all Products when pressing the "Keyboard Down Arrow" on the RadAutoCompleteBox. Is this possible?

 

<telerik:RadAutoCompleteBox Height="23" Width="180" Background="#FFEDF4AB" Margin="3,0,0,0" ItemsSource="{Binding Products}" SelectedItem="{Binding SelectedProductItem, Mode=TwoWay}" SelectionMode="Single" TextSearchMode="StartsWith" SearchText="{Binding Name, Mode=TwoWay}" TextSearchPath="Name" DisplayMemberPath="Name" AutoCompleteMode="Suggest" > <telerik:RadAutoCompleteBox.DropDownItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Name}" FontWeight="Bold" Foreground="Black" Width="200" /> </StackPanel> </DataTemplate> </telerik:RadAutoCompleteBox.DropDownItemTemplate> <Behaviors:Interaction.Triggers> <Behaviors:EventTrigger EventName="SelectionChanged"> <Behaviors:InvokeCommandAction Command="{Binding SelectProductCommand}" /> </Behaviors:EventTrigger> </Behaviors:Interaction.Triggers> </telerik:RadAutoCompleteBox>
Dimitar
Telerik team
 answered on 31 May 2024
0 answers
73 views

I am using a WPF RadAutoCompleteBox control in my application, I am trying to set a custom style to this control but there are a few behaviors I could not get it right.

This is the current look of the control:

The colors I wish to change:

1. Text color in the textblock as pointed with the green arrow.

2. The background of the selected item in the drop down menu as pointed with the blue arrow. Currently it is showing as transparent, but I wish change it into a solid color.

3. The transparent background of the drop down menu as pointed with the purple arrow.

I have tried to change the background and foreground properties but could not see the effect on the control. I have attached the style file I used for the control.

Any advice?

Thank you!

boon
Top achievements
Rank 1
 updated question on 29 Apr 2024
1 answer
109 views
Hello. How I can styling WatermarkContent in RadAutoCompleteBox?
For example DateTimeWatermarkTemplateProperty in RadDateTimePicker is simple to set. 
Martin Ivanov
Telerik team
 answered on 15 Apr 2024
0 answers
105 views

Hi
Please find my below code showing the celledittemplate

<telerik:GridViewDataColumn.CellEditTemplate>
    <DataTemplate>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <tbcontrols:SmartSearchRadAutoCompleteBox x:Name="JournalSuggestions" AutomationProperties.AutomationId="JournalSuggestions" 
                                        Style="{StaticResource SmartControlStyle}"  
                                        SelectionMode="Single" 
                                        KeyDown="JournalSuggestions_KeyDown"                                                                        
                                        PreviewGotKeyboardFocus="JournalSuggestions_PreviewGotKeyboardFocus"
                                        Populating="JournalSuggestions_Populating"
                                        Width="{Binding RelativeSource={RelativeSource AncestorType=telerik:GridViewDataColumn}, Path=ActualWidth}"
                                        BorderThickness="0" 
                                        BorderBrush="Transparent" 
                                        ClipToBounds="True" 
                                        AutoCompleteMode="Suggest"
                                        ItemsSource="{Binding Source={StaticResource SmartJournalAccounts}}"
                                        DisplayMemberPath="Code" 
                                        FilteringBehavior="{StaticResource LocalJournalFilter}"
                                        HorizontalAlignment="Stretch" 
                                        VerticalAlignment="Stretch"
                                        VerticalContentAlignment="Center"
                                        DropDownItemTemplate="{Binding Source={StaticResource CustomDropDownTemplate}}" 
                                        NoResultsContentTemplate="{StaticResource NoResultsContentTemplate}"
                                        DropDownWidth="Auto"  
                                        BoxesItemStyle="{StaticResource CustomRadAutoCompleteBoxesItemStyle}" 
                                        IsEnabled="True" 
                                        Margin="-17 0 0 0"                                                                        
                                        SearchText="{Binding DataContext.SmartControlSearchText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}}, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
                                        SelectedItem="{Binding Path=SmartJournalAccountItem, Mode=TwoWay}"
                                        TextSearchMode="Contains" TextBoxStyle="{StaticResource TrailBalanceAccountTextBoxStyle}" FontSize="12" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <cal:ActionMessage MethodName="AutoCompleteBoxSelectionChanged">
                            <cal:Parameter Value="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadAutoCompleteBox}}}"></cal:Parameter>
                        </cal:ActionMessage>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <i:Interaction.Behaviors>
                    <behaviours:RadAutoCompleteBoxBehavior/>
                </i:Interaction.Behaviors>
            </tbcontrols:SmartSearchRadAutoCompleteBox>
            <Button x:Name="SearchButton" Grid.Column="1"
DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=controls:APTPanel}}"
                    Click="SearchButton_Click">                
                <Button.Visibility>
                        <con:ConverterBindableBinding Binding="{Binding IsSearchAccountVisible,UpdateSourceTrigger=PropertyChanged}" 
                                                      Converter="{StaticResource BooleanToVisibilityConverter}"
                                                      ConverterParameterBinding="{Binding IsSearchAccountVisible, RelativeSource={RelativeSource AncestorType={x:Type controls:APTPanel}}, UpdateSourceTrigger=PropertyChanged}">
                        </con:ConverterBindableBinding>
                    </Button.Visibility>
            </Button>
        </Grid>
    </DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>

If I click the "SearchButton" on first click the event does not fire, the click event fires if I click it second time.
If I remove the SmartSearchRadAutoCompleteBox  control & only keep the SearchButton then it works ok.

Can someone give me code snippet having multiple controls (one radautosearchbox & one button) in datatemplate of celledittemplate or help me understand what is causing issue in my  Click event

Regards,
Swapnil. 

swapnil
Top achievements
Rank 1
 updated question on 19 Mar 2024
1 answer
65 views

See the following:

Dispatcher process has been suspended, but messages are still being processed. in UI for WPF | Telerik Forums

I cannot reproduce using a simple test project. I am attaching a Word VSTO project that is a test version. I have removed packages which included Fody PropertyChanged and the Telerik Xaml controls.

We are seeing a Dispatch Processor error in Word when the HighlightText is enabled. It goes away if that is removed. Our VSTO project is way too large to easily demo but we passed QA if that HighlightText is removed. Why that is happening is hard to say since Word COM provides little to no information on the issue.

I will compare code against Vladimir's sample and see if I can spot differences. Will get back if something pops out.

 

Vladimir Stoyanov
Telerik team
 answered on 24 Jan 2024
1 answer
76 views
In the WPF Demos (RadAutoCompleteBox RadHighlightTextBox), the only code shown is a skeleton XAML and not the parts of the code that actually do the work. Where can I find that example's code? I searched the Telerik GitHub repos to no avail.
Stenly
Telerik team
 answered on 01 Jan 2024
1 answer
79 views

Hi,

Would it be possible to have an editable AutoCompleteBox TextBox Part to mimic the RadWatermarkTextBox with floating Label?

Stenly
Telerik team
 answered on 01 Mar 2023
1 answer
310 views
I have the following class

Class My Class
Class MyClass()
{
   public int Var1 {get; set; }
   public int Var2 {get; set; }
}
i want the selected item to show {var1}/{var2}
for now im doing (for now) is
DisplayMemberPath = "Var1"
but because its a String and a Dependency property i cannot attach a MultiBinding
and RadMultiColumnComboBox  does not have itemTemplate property
how can i achieve it

P.S 
I want the same behavior for the tooltip

p.s 2
i also want to center the selected text but it seems HorizontalContentAlignment  is not working


Thanks in advance

Martin Ivanov
Telerik team
 answered on 30 Jan 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?