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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:49:36+00:00 2026-05-27T00:49:36+00:00

I have a cell template for listview is defined as follows: <DataTemplate x:Key=editableIPAddressColTemplate> <Grid

  • 0

I have a cell template for listview is defined as follows:

<DataTemplate x:Key="editableIPAddressColTemplate">
    <Grid x:Name="dtTemplateGrid">
        <TextBlock Width="100" FontSize="11" Text="{Binding ElementName=txt, Path=Text, Mode=TwoWay}" 
                   ToolTip="{Binding ElementName=txt, Path=ToolTip, Mode=OneWay}"
                        Style="{StaticResource GridBlockStyle}">
        </TextBlock>
        <TextBox x:Name="txt" FontSize="11" Width="100" Style="{StaticResource GridEditStyle}"
                 Validation.Error="TextBox_Error" LostFocus="txt_LostFocus" >
            <Binding Path="IPAddress" Mode="TwoWay" ValidatesOnDataErrors="True" 
                     ValidatesOnExceptions="True" NotifyOnValidationError="True">
                <Binding.ValidationRules>
                    <local:IPAddressValidationRule>
                        <local:IPAddressValidationRule.Params>
                            <local:ValidationParameters BoundListView="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListView}}}"/>
                        </local:IPAddressValidationRule.Params>
                    </local:IPAddressValidationRule>
                </Binding.ValidationRules> 
            </Binding>
        </TextBox>
    </Grid>                
</DataTemplate>

The IPAddressValidationRule is derived from ValidationRule and has a property called Params which is of type ValidationParameters. The ValidationParameters class is derived from dependency object and has a property called BoundListView which is of type ListView.

When I see through debugger, in side the IPValidationRule class, the BoundListView property is always null. What am I doing wrong?

I would greatly appreciate if anybody can help me figure out this.

Thanks a lot in advance.

  • 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-05-27T00:49:37+00:00Added an answer on May 27, 2026 at 12:49 am

    You have a break in the tree, the validation rules just float about as property of a binding, you cannot use ElementName or RelativeSource in such a disconnected place. Check the output window and you should be able to see some binding errors regarding this.

    You could try naming the ListView and set the Binding.Source using x:Reference (x:Reference does not like cyclical dependencies, so you need to watch out for that)

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

Sidebar

Related Questions

the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,
I have a xaml file with this code: <GridViewColumn x:Name=lvCol3 Header=Quantità Width=120> <GridViewColumn.CellTemplate> <DataTemplate>
I have following WPF ListView: <ListView Grid.Column=2 Grid.Row=1 Margin=0,53,12,6 Name=lvwProperties ItemsSource={Binding Path=SelectedPropertyItems, Mode=TwoWay} Grid.ColumnSpan=2>
Here is the problem: I have a ListView as following: <UserControl.Resources> <DataTemplate x:Key="FirstCell"> <StackPanel
I have a WPF ListView ( GridView ) and the cell template contains a
I have a listview with following column <GridViewColumn Header=name local:GridViewSort.PropertyName=Name> <GridViewColumn.CellTemplate> <DataTemplate> <TextBox Text={Binding
I want my datagrid columns to share a cell/celledit template. I have the solution
I have a listview and I need to have width of first column automatic
A ListView with Datatemplate in GridViewColumn: <ListView Name =LogDataList IsSynchronizedWithCurrentItem=True ItemsSource={Binding LogDataCollection} Background=Cyan> <ListView.View>
I have a ListView to display log events. A style trigger is defined to

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.