Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8930713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:57:18+00:00 2026-06-15T08:57:18+00:00

trying to use classic Wpf structure via AutoCompleteBox (not using ViewModel) as i am

  • 0

trying to use classic Wpf structure via AutoCompleteBox (not using ViewModel)

as i am new to WPF and yet to acquire knowledge of MVVM..

My Code For now :

P.S

for usage on this sample code,
source file should be – tab separated,each line would be as follows:

a line No’ (only for reference), tab separation , value for AutoComplete.

  1. every line
  2. has value
  3. separated by
  4. Tab = “\t”

XAML:

Main declaration – window

// this happens to be a borderless - window with custom buttons
<Window x:Class="AllDayWpf.MainWindow" Icon="/AllDayWpf;component/bin/Debug/ScheduledTICON.png"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:acb="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
    xmlns:System="clr-namespace:System;assembly=mscorlib" 
    Title="Daily Tasks Srv-2" Height="555" Width="731" 
    ResizeMode="NoResize" 
    WindowStyle="None"
    AllowsTransparency="True" Background="{x:Null}"> 

<Window.Effect>
    <DropShadowEffect Opacity="0.5" BlurRadius="5" ShadowDepth="5" />
</Window.Effect>

a Grid within a TabItem (i guess rest is irrelevant):

<Grid>
      <ListBox Name="LBX_AddTaskOptions" SelectionChanged="LBX_AddTaskOptions_SelectionChanged"  HorizontalAlignment="Left" Margin="19,29,0,0"  VerticalAlignment="Top" Width="125" FontWeight="Bold" Background="Beige">
          <ListBoxItem Background="#9B6ADBCD" FontWeight="Bold" BorderBrush="#FF27AA27">
              <StackPanel Orientation="Horizontal">
                     <TextBlock Text="internet" Width="74"></TextBlock>
                     <Image Source="Images\IE_BlackRed.png" Height="30"></Image>
               </StackPanel>
          </ListBoxItem>
          <ListBoxItem Background="#9B6ADBCD" FontWeight="Bold" BorderBrush="#FF27AA27">
               <StackPanel Orientation="Horizontal">
                     <TextBlock Text="Local Folder" Width="74"></TextBlock>
                     <Image Source="Images\Folder_Black.png" Height="30" Width="32"></Image>
             </StackPanel>
      </ListBoxItem>
  </ListBox>
      <acb:AutoCompleteBox Name="UrlACBXml" ValueMemberPath="url" HorizontalAlignment="Left" Grid.Column="1" Width="296" Margin="150,23,0,156" Background="#FFEDF4AB">
           <acb:AutoCompleteBox.ItemTemplate>
                 <DataTemplate>

                      <StackPanel Orientation="Horizontal">

                            <TextBlock Text="{Binding url}" FontWeight="Bold" Foreground="Black" Width="30"/>
                       </StackPanel>
                  </DataTemplate>
              </acb:AutoCompleteBox.ItemTemplate>    
       </acb:AutoCompleteBox>
</Grid>

that’s where i needed the autoCompletebox To be placed.
ACB initial Visibility = hiden.
then, if user selects item-internet, this ACB Will turn To Visible.

(just the idea, not implemented here at this stage)

C# AutoComplete code.

public MainWindow()
{
    InitializeComponent();

    MyUrlObsrvblCollcntFactory UrlObsrCollcntFctry= new MyUrlObsrvblCollcntFactory();
    UrlACBXml.ItemsSource = UrlObsrCollcntFctry.AutComplObsrvblCllctn;
}

public class MyUrlObsrvblCollcntFactory
{
    public class URLsSrcClss
    {
        public string url { get; set; }
    }
    String path = System.IO.Path.Combine(Environment.CurrentDirectory,"tst.txt");
    string[] testit;
    public ObservableCollection<URLsSrcClss> AutComplObsrvblCllctn { get; set; }
    public MyUrlObsrvblCollcntFactory()
    {
        if (File.Exists(path))
        {
            testit = File.ReadLines(path).ToArray();
            foreach (var item in testit)
            {
                var TabSeparatedItemArr = item.Split('\t');
                this.AutComplObsrvblCllctn.Add( new URLsSrcClss { url = TabSeparatedItemArr[1] }
                );
            }
        }
    }
}

the problem is that when i have tested autoComplete
i have used

ObservableCollection<URLsSrcClss> AutComplObsrvblCllctn = new ObservableCollection<URLsSrcClss> 
{
    new URLsSrcClss {url = "say yhoo..."},
    new URLsSrcClss {url = "...google..."},
};

it did work

though changing code to be generated out of a large data source
is i guess what’s breaking functionality.
that’s at least what i think for now.

any ideas what is wrong in my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:57:19+00:00Added an answer on June 15, 2026 at 8:57 am

    it is working now I just made a mistake not initializing it properly
    the code above will not work , I’ve decided to leave it as a question..with my answer as well.. for future comers sake .

    so any fresh developers that has WPF AutoCompleteBox implemetation issues
    could have this nice solution to solve the problem.

            public ObservableCollection<URLsSrcClss> AutComplObsrvblCllctn = new ObservableCollection<URLsSrcClss>();
    

    having said that, your welcome to share your thoughts, ideas,critics or tips…

    so if you have any, please do comment it here.

    thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I'm trying to evaluate whether to use classic Principal based authorization vs. IdentityModel authorization.
We're currently trying to integrate existing classic ASP pages into our new method of
I'm trying to use some impersonation functions in a classic ASP page. I found
I'm trying to create and use a .NET StreamWriter object inside a classic ASP
I'm trying to call a .NET component using interop from a classic ASP page
I am trying to use the OWASP with some Classic ASP app, but did
I'm not really debating which PHP framework to use as much as I'm trying
I'm trying to build a WPF DrawingBrush that will draw a hatch pattern using
i'm trying use facebook API to upload photo in my fan page. I downloaded

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.