In XAML, How does a Grid inherit properties base on its "Name"?

I have picked up responsibility for an app I did not originate and am still relatively new to XAML.

I have a <Grid> at the base of a usercontrol that seems to be inheriting properties when it has the "Name" attribute set.  I have done a "Find" on the "Entire Solution" for the name but don't see where this code is being setup.  I have looked in Resources files specifically but nothing there either, that I can see.


TIA!
LVL 1
BruceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fernando SotoRetiredCommented:
Hi Bruce;

You state the following, "I have a <Grid> at the base of a usercontrol that seems to be inheriting properties when it has the "Name" attribute set. ", from Microsoft documentation:

Property Value Inheritance
Property value inheritance enables child elements in a tree of elements to obtain the value of a particular property from parent elements

So it is not based on it having a Name attribute.  If you can post the user control and give a detail description of what you are trying to find I will see If I can help. Also please read the post Property Value Inheritance.
0
Fernando SotoRetiredCommented:
Is this maybe what you mean?

You can also change the look of a control by using Named resource keys in the resource section of the XAML or resource dictionary.

XAML Resources
0
BruceAuthor Commented:
On your second question, yes, we have Resource files that contain Styles and TargetTypes but none seem to match the control type I am using.

Here's the code...
<UserControl x:Class="CST.CustomerService.Forms.Views.Compliance.ZeroUsageFormView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:fv="clr-namespace:CST.CustomerService.Forms.Views"
             xmlns:fvm="clr-namespace:CST.CustomerService.Forms.ViewModels"
             xmlns:sdmfv="clr-namespace:CST.CustomerService.Forms.Views.Shared"  
             xmlns:sdmfvm="clr-namespace:CST.CustomerService.Forms.ViewModels.Shared" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="1000">
    <UserControl.Resources>
        <ResourceDictionary>
            <DataTemplate DataType="{x:Type sdmfvm:SharedGeneralCustomerInfoControlViewModel}">
                <sdmfv:SharedGeneralCustomerInfoControlView />
            </DataTemplate>
            <DataTemplate DataType="{x:Type fvm:CustomerServiceTransactionsFormViewModel}">
                <fv:CustomerServiceTransactionsFormView />
            </DataTemplate>
            <DataTemplate DataType="{x:Type fvm:CustomerServiceDeviceFormViewModel}">
                <fv:CustomerServiceDeviceFormView />
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Name="MainGrid" HorizontalAlignment="Stretch" Visibility="Visible" Margin="0,4,0,-4" Background="White">

Open in new window


When I remove the "Name" Attribute from the <Grid...> declaration then I am able to set the background color...and have it stick.  

I am trying to override at behavior I think is in the DevExpress NavBarItem control that Highlights the control on mouseover.  I have not been able to disable this behavoir or override with the Styles or triggers so I've opted to just set the background to white for now and solution it down the road.

Hope that code helps...  Thanks for responding...
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Fernando SotoRetiredCommented:
Well the only way the Background color is going to change is through code, you say you did a search in all the files in the project, you searched for the name MainGrid, correct?
0
BruceAuthor Commented:
This has to do with the NavBarItem...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BruceAuthor Commented:
Because it wasn't really solved and I want the readers that find this to know.  

I gave the points to the only respondent
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.