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 8664603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:16:48+00:00 2026-06-12T17:16:48+00:00

I have a listview and a textbox in my xaml file. View: <ListView Grid.Column=0

  • 0

I have a listview and a textbox in my xaml file.

View:

<ListView Grid.Column="0" ItemsSource="{Binding I2CDeviceList}" SelectedItem="{Binding SelectedI2CDeviceList, Mode=TwoWay}" Name="I2cDeviceList" >
       <ListView.View>
              <GridView>
                    <GridViewColumn Header="I2C Device" Width="Auto" DisplayMemberBinding="{Binding I2CDevName}" />
                    <GridViewColumn Header="I2C Device Address" Width="Auto" DisplayMemberBinding="{Binding I2CDeviceAddress}" />
              </GridView>
       </ListView.View>
</ListView>

<TextBox Height="23" Grid.Column="1" Name="AddressI2C" Text="{Binding Path=AddressMessage, Mode=TwoWay}" />

View Model:

//List View Property
public ObservableCollection<I2CModel> I2CDeviceList
    {
        get { return _I2CDeviceList; }
        set
        {
            _I2CDeviceList = value;
            NotifyPropertyChanged("I2CDeviceList");
        }
    }

    private I2CModel _selectedI2CDeviceList;
    public I2CModel SelectedI2CDeviceList
    {
        get { return _selectedI2CDeviceList; }
        set
        {
            _selectedI2CDeviceList = value;
            AddressMessage = _selectedI2CDeviceList.I2CDeviceAddress; //Displays Address in My textBox
            NotifyPropertyChanged("SelectedI2CDevSize");
        }
    }

// Property for textBox
private string _AddressMessage;
public string AddressMessage
    {
        get
        {
            return _AddressMessage;
        }
        set
        {
            _AddressMessage = value;
            NotifyPropertyChanged("AddressMessage");
        }
    }

My requirement is,

When i launch the application, is it possible to have the first item of the listview selected by default? I.e. if the first item in my listview is “Chip Id”, “0x03”, on startup it should be selected by default and the address (0x03) must also get displayed in AddressMessage Textbox.

  • 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-12T17:16:49+00:00Added an answer on June 12, 2026 at 5:16 pm

    In your ViewModel Set SelectedI2CDeviceList to default value at the time of launch. I use ViewModel Constructor to set SelectedItem so that when my window is launched my view shows the selected value.

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

Sidebar

Related Questions

I have a listview with following column <GridViewColumn Header=name local:GridViewSort.PropertyName=Name> <GridViewColumn.CellTemplate> <DataTemplate> <TextBox Text={Binding
I have a setup, something confusing like this: <ListView> <ItemTemplate> <div id=Content> <asp: TextBox
I have a listview who's itemssource is a ObservableCollection of MyModel. I am trying
I have 3 controls in a WPF window.. a textbox, listbox and listview. The
I have a textbox in a listview itemtemplate. I want to change the background
I have a cell template for listview is defined as follows: <DataTemplate x:Key=editableIPAddressColTemplate> <Grid
I have the following xaml which resides in a wpf user control - <Grid>
Say I have a ListView control with a TextBox control in the ItemTemplate: <asp:ListView
In my WPF application (XAML posted below), I have a List View and below
I have created a listview (in xaml), where I have used GridViewColumn with DisplayMemberBinding

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.