Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WPF Weird behavior or me? [modified]

WPF Weird behavior or me? [modified]

Scheduled Pinned Locked Moved WPF
wpfhelpcsharpwcfcom
15 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Mike HankeyM Mike Hankey

    Thanks for your input Pete,

    Pete O'Hanlon wrote:

    horizontalalignment="Stretch">;Style="{StaticResource CustomBorderStyle}"

    I'm a terrible typer...I was going back and adding the < and > 's and produced the typo. I get these error periodically when working with UserControls, which is where the style is used and I get 3 errors. Could not create instance of ProjectView (my user control) Value TaskMgrResourceDictionary.xaml cannot be assigned to property 'Source'. The resource dictionary XAML file has errors and cannot be loaded. The application XAML file failed to load. Fix errors in the application XAML before opening the XAML files. Like you if I strip this code out and and use it in line it works great. Its in several locations also, and all are user controls? Except for the MainWindow not showing because of the errors in the user controls. Thanks, Mike

    "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


    Semper Fi http://www.hq4thmarinescomm.com[^] My Site

    M Offline
    M Offline
    Mark Salsbery
    wrote on last edited by
    #6

    Mike Hankey wrote:

    Value TaskMgrResourceDictionary.xaml cannot be assigned to property 'Source'. The resource dictionary XAML file has errors and cannot be loaded.

    Since it works inline, your problem seems to be in the resources, as indicated by the errors. That's probably a good place to look for errors :)

    Mark Salsbery Microsoft MVP - Visual C++ :java:

    Mike HankeyM 1 Reply Last reply
    0
    • M Mark Salsbery

      Mike Hankey wrote:

      Value TaskMgrResourceDictionary.xaml cannot be assigned to property 'Source'. The resource dictionary XAML file has errors and cannot be loaded.

      Since it works inline, your problem seems to be in the resources, as indicated by the errors. That's probably a good place to look for errors :)

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #7

      Mark, I had this problem using a DataGrid control and turned out that I could remove the code that styled the headers and it worked for a while then quit again a short time later. I'm thinking it has something to do with UserControls but not quite sure. The reason I posted this question was to see if anyone else had had this problem using UserControls in their app. I've heard that there are problems using them and was wanting to see if this was one of them. Thanks, Mike

      "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


      Semper Fi http://www.hq4thmarinescomm.com[^] My Site

      P 1 Reply Last reply
      0
      • Mike HankeyM Mike Hankey

        Mark, I had this problem using a DataGrid control and turned out that I could remove the code that styled the headers and it worked for a while then quit again a short time later. I'm thinking it has something to do with UserControls but not quite sure. The reason I posted this question was to see if anyone else had had this problem using UserControls in their app. I've heard that there are problems using them and was wanting to see if this was one of them. Thanks, Mike

        "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


        Semper Fi http://www.hq4thmarinescomm.com[^] My Site

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #8

        I use UserControls extensively and I've never had any problems with them. The only thing I can think of is that you might have a problem with the way they have been registered when you have merged your ResourceDictionaries.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys

        Mike HankeyM 1 Reply Last reply
        0
        • P Pete OHanlon

          I use UserControls extensively and I've never had any problems with them. The only thing I can think of is that you might have a problem with the way they have been registered when you have merged your ResourceDictionaries.

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys

          Mike HankeyM Offline
          Mike HankeyM Offline
          Mike Hankey
          wrote on last edited by
          #9

          Operator error, surely not. :) This is my app.xaml file.

          <Application x:Class="WpfTaskManager.App"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

          <Application.Resources>
          <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
          <ResourceDictionary Source="TaskMgrResourceDictionary.xaml"/>
          </ResourceDictionary.MergedDictionaries>
          </ResourceDictionary>
          </Application.Resources>
          </Application>

          Appreciate the input. You've convinced me that I am the cause of the problem so will get with the program and find it. Didn't want to pull my hair out over this one, (as I get older and my hair thinner I have to be careful of the problems involving hair pulling. :), if it wasn't something that I had done. Thanks, Mike

          "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


          Semper Fi http://www.hq4thmarinescomm.com[^] My Site

          M 1 Reply Last reply
          0
          • Mike HankeyM Mike Hankey

            Operator error, surely not. :) This is my app.xaml file.

            <Application x:Class="WpfTaskManager.App"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

            <Application.Resources>
            <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="TaskMgrResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
            </Application.Resources>
            </Application>

            Appreciate the input. You've convinced me that I am the cause of the problem so will get with the program and find it. Didn't want to pull my hair out over this one, (as I get older and my hair thinner I have to be careful of the problems involving hair pulling. :), if it wasn't something that I had done. Thanks, Mike

            "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


            Semper Fi http://www.hq4thmarinescomm.com[^] My Site

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #10

            Mike, Ditto Pete's reply - If UserControls had a major malfunction I'd be in a world of pain and tears :) I still suspect the culprit is in the bowels of your TaskMgrResourceDictionary.xaml. Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            Mike HankeyM 1 Reply Last reply
            0
            • M Mark Salsbery

              Mike, Ditto Pete's reply - If UserControls had a major malfunction I'd be in a world of pain and tears :) I still suspect the culprit is in the bowels of your TaskMgrResourceDictionary.xaml. Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              Mike HankeyM Offline
              Mike HankeyM Offline
              Mike Hankey
              wrote on last edited by
              #11

              Thanks guys, You are probably right, its got to be somewhere in there and will remove code until I find it. I'm just getting my sleaves rolled up with WPF and am bound to make many stupid mistakes. Hope y'all will bear with me. I can get most of them without help but sometimes I just plain get frustrated and need a shove, or a shift kick in the kester. Thanks again, Mike

              "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


              Semper Fi http://www.hq4thmarinescomm.com[^] My Site

              P 1 Reply Last reply
              0
              • Mike HankeyM Mike Hankey

                Thanks guys, You are probably right, its got to be somewhere in there and will remove code until I find it. I'm just getting my sleaves rolled up with WPF and am bound to make many stupid mistakes. Hope y'all will bear with me. I can get most of them without help but sometimes I just plain get frustrated and need a shove, or a shift kick in the kester. Thanks again, Mike

                "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


                Semper Fi http://www.hq4thmarinescomm.com[^] My Site

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #12

                Mike - I've got to recommend Blend as an invaluable help here. It allows you to save resources, which you set through the interface, removing chances for errors.

                "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                My blog | My articles | MoXAML PowerToys

                Mike HankeyM 1 Reply Last reply
                0
                • P Pete OHanlon

                  Mike - I've got to recommend Blend as an invaluable help here. It allows you to save resources, which you set through the interface, removing chances for errors.

                  "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                  As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                  My blog | My articles | MoXAML PowerToys

                  Mike HankeyM Offline
                  Mike HankeyM Offline
                  Mike Hankey
                  wrote on last edited by
                  #13

                  Pete O'Hanlon wrote:

                  I've got to recommend Blend as an invaluable help here

                  Pete, You are probably right but there are/were two things that held me back from purchasing; 1) I'm just to damn cheap to buy it, can't justify the $500 2) I looked at like this. It's like driving a car, if you learn to drive a stick you can drive anything on the road, if you learn automatic your limited. Don't know if this makes any sense or not? I've got a trial version of blend but really haven't taken the time that I should with it. Boss at work gave us an assignment to do an Outlook demo and I thought it was pretty cool, had some quirks but it was probably just me. I'll give blend another try. Thanks, Mike

                  "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


                  Semper Fi http://www.hq4thmarinescomm.com[^] My Site

                  P 1 Reply Last reply
                  0
                  • Mike HankeyM Mike Hankey

                    Pete O'Hanlon wrote:

                    I've got to recommend Blend as an invaluable help here

                    Pete, You are probably right but there are/were two things that held me back from purchasing; 1) I'm just to damn cheap to buy it, can't justify the $500 2) I looked at like this. It's like driving a car, if you learn to drive a stick you can drive anything on the road, if you learn automatic your limited. Don't know if this makes any sense or not? I've got a trial version of blend but really haven't taken the time that I should with it. Boss at work gave us an assignment to do an Outlook demo and I thought it was pretty cool, had some quirks but it was probably just me. I'll give blend another try. Thanks, Mike

                    "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


                    Semper Fi http://www.hq4thmarinescomm.com[^] My Site

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #14

                    Mike Hankey wrote:

                    if you learn to drive a stick you can drive anything on the road, if you learn automatic your limited. Don't know if this makes any sense or not?

                    I'm from the UK. That's pretty much the only way to learn over here. ;) If you learn automatic over here, you're not qualified to drive stick.

                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                    My blog | My articles | MoXAML PowerToys

                    1 Reply Last reply
                    0
                    • Mike HankeyM Mike Hankey

                      Hey y'all has anyone else run across this problem? and if so is there a work around? I have a ResourceDictioinary where I have a linear brush declared;

                      <LinearGradientBrush x:Key="BlueLinearBrush" EndPoint="0.5,1" StartPoint="0.5,0">
                          <gradientstop color="PowderBlue" offset="0" />
                           <gradientstop color="SteelBlue" offset="1" />
                      </LinearGradientBrush>
                      

                      and a style that uses the Brush

                       <style x:key="CustomBorderStyle" targettype="{x:Type Border}">
                           <setter property="Background" value="{StaticResource BlueLinearBrush}" />
                          .....
                       </style>
                      

                      In my App.xaml file I have cone the MergeDictioinaires then in my code I use it:

                      .....
                       <border horizontalalignment="Stretch">**Style="{StaticResource CustomBorderStyle}"**\>
                           <textblock text="{Binding Path=Name}" horizontalalignment="Center" fontweight="Bold" />
                       </border>
                      .....
                      

                      but it gives me problems here? I've googled and the examples I've found say this is legal as seen here[^]. The app runs fine but its annoying because I can't see the design or look at properties because of the error. WTF? Mike

                      "It doesn't matter how big a ranch ya' own, or how many cows ya' brand, the size of your funeral is still gonna depend on the weather." -Harry Truman.


                      Semper Fi http://www.hq4thmarinescomm.com[^] My Site

                      modified on Sunday, March 15, 2009 8:26 PM

                      Z Offline
                      Z Offline
                      zameb
                      wrote on last edited by
                      #15

                      Use DynamicResource because the resource is defined in an external file and will not be resolved until runtime.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups