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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:33:05+00:00 2026-05-12T11:33:05+00:00

I have a UserControl with a Border element within it that I want to

  • 0

I have a UserControl with a Border element within it that I want to style with a particular Border style. It compiles but won’t start, giving a XamlParseException, saying, “Cannot find resource …”

Is there a way to do this?

Thanks.

App.xaml:

<cal:CaliburnApplication x:Class="WahnamProgressTracker.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.caliburnproject.org"
xmlns:Converters="clr-namespace:WahnamProgressTracker.Converters;assembly=WahnamProgressTracker"
xmlns:Model="clr-namespace:WahnamProgressTracker.Model">
<Application.Resources>
    <Style x:Key="FancyBorder"
           TargetType="{x:Type Border}">
        <Setter Property="Margin" Value="0,0,0,8"/>
        <Setter Property="Padding" Value="8"/>
        ...
    </Style>
</Application.Resources>

MainView.xaml:

<Window x:Class="WahnamProgressTracker.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.caliburnproject.org"
xmlns:uc="clr-namespace:WahnamProgressTracker.UserControls"
MinHeight="500" MinWidth="800">

<DockPanel>
    <uc:MainViewMenu x:Name="menu"
                     DockPanel.Dock="Top" />

    <StatusBar x:Name="quoteBar"                   
               DockPanel.Dock="Bottom">
        <TextBlock Text="{Binding Path=Quote.Text, Mode=OneWay}" />
    </StatusBar>

    <uc:MainViewNavigation x:Name="navigationBar"
                           DockPanel.Dock="Left" />

    <uc:ProgressGraph x:Name="graph" />
</DockPanel>

MainViewNavigation.xaml (user control):

<UserControl x:Class="WahnamProgressTracker.UserControls.MainViewNavigation"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Border Style="{StaticResource FancyBorder}">
        ...       
    </Border>    
</UserControl>
  • 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-12T11:33:05+00:00Added an answer on May 12, 2026 at 11:33 am

    Can you post a sample of what you mean? The only case in which your issue can occur is if the User Control is created and then rendered outside your application’s visual tree.

    The XAML below works for me:

    App.xaml:

    <Application x:Class="WpfApplication1.App"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     StartupUri="Window1.xaml">
        <Application.Resources>
            <Style TargetType="{x:Type TextBlock}" x:Key="myStyle">
                <Setter Property="Foreground" Value="Green" />
                <Setter Property="FontWeight" Value="Bold" />
            </Style>
        </Application.Resources>
    </Application>
    

    Window1.xaml:

    <Window x:Class="WpfApplication1.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:local="clr-namespace:WpfApplication1"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300">
        <Grid>
            <local:UserControl1 />
        </Grid>
    </Window>
    

    UserControl1.xaml:

    <UserControl x:Class="WpfApplication1.UserControl1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="300" Width="300">
        <Grid>
            <TextBlock Style="{StaticResource myStyle}">HEY!</TextBlock>
        </Grid>
    </UserControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UserControl (XAML below) that has a ListBox that I want to
I have a simple UserControl whose direct Child element is a border:- <Border x:Name=LayoutRoot
I have the following as a custom user control: <UserControl x:Class=TestGUI.TBorder> <Border Style={StaticResource brdListBoxItem}>
I have a usercontrol that has several public properties. These properties automatically show up
I have a UserControl that consists of three TextBoxes. On a form I can
I have a UserControl in my Asp.net project that has a public property. I
I have a usercontrol that is meant to take up the entire form. I
I am using WPF UserControl and I have a grid so I want to
I want to create my own expandable/collapsable tree-like UserControl, which nodes are the Border
It is in Winforms. I have a UserControl that is anchored TOP, BOTTOM and

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.