Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

ResourceDictionary bug

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-16-2006   #1 (permalink)
Guillaume
Guest


 

ResourceDictionary bug

Hi,
I have found a strange bug with ResourceDictionary and VS 2k5, when running
a exe twice i get a "Item already added" error in ResourceDictionary.
Here is a code sample :

Code:
<Window x:Class="TestWinFX.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWinFX" Height="82" Width="141"
>
<!-- Resources -->
<Window.Resources>
<!-- Gradients -->
<LinearGradientBrush x:Key="MyGradient" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FFFFFFFF" Offset="0" />
<GradientStop Color="#FFFF0000" Offset="1" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Window.Resources>

<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"
Height="37" Width="99">
<Button VerticalAlignment="Center" HorizontalAlignment="Center"
Width="89" Height="27" Name="button1" Content="MyButton">
<Button.Template>
<ControlTemplate>
<Grid>
<Rectangle Stroke="Black" Fill="{DynamicResource MyGradient}"
RadiusX="5" RadiusY="5" />
<ContentPresenter
Content="{TemplateBinding Button.Content}"
HorizontalAlignment="{TemplateBinding
Button.HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding
Button.VerticalContentAlignment}"
/>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</Window>
Build the projet, run it in debug, close the window, modify the file (add a
return anywhere), build and run, you have the bug.
Only solution i found is force a rebuild and not a build.

Any idea of where it comes from ?

Guillaume

My System SpecsSystem Spec
Old 03-22-2006   #2 (permalink)
Rob Relyea [MSFT]
Guest


 

Re: ResourceDictionary bug

I belive this is a known issue with the Feb CTP.
Unfortunately, the only work around is to clean/build.

This was a bug in newly implemented improvements in incremental build (an
attempt to build fewer xaml files each time you compiled).
Sorry.
Thx, Rob Relyea
WPF, PM
http://longhornblogs.com/rrelyea

"Guillaume" <Guillaume@discussions.microsoft.com> wrote in message
news:B9CC895E-F80F-4F31-863C-B2D9DABDE58B@microsoft.com...
> Hi,
> I have found a strange bug with ResourceDictionary and VS 2k5, when
> running
> a exe twice i get a "Item already added" error in ResourceDictionary.
> Here is a code sample :
>
>
Code:
> <Window x:Class="TestWinFX.Window1"
>  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
>  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>  Title="TestWinFX" Height="82" Width="141"
>  >
>    <!-- Resources -->
>    <Window.Resources>
>      <!-- Gradients -->
>      <LinearGradientBrush x:Key="MyGradient" StartPoint="0,0"
> EndPoint="0,1">
>        <LinearGradientBrush.GradientStops>
>          <GradientStop Color="#FFFFFFFF" Offset="0" />
>          <GradientStop Color="#FFFF0000" Offset="1" />
>        </LinearGradientBrush.GradientStops>
>      </LinearGradientBrush>
>    </Window.Resources>
>
>    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"
> Height="37" Width="99">
>      <Button VerticalAlignment="Center" HorizontalAlignment="Center"
> Width="89" Height="27" Name="button1" Content="MyButton">
>        <Button.Template>
>          <ControlTemplate>
>            <Grid>
>              <Rectangle Stroke="Black" Fill="{DynamicResource MyGradient}"
> RadiusX="5" RadiusY="5" />
>              <ContentPresenter
>                Content="{TemplateBinding Button.Content}"
>                HorizontalAlignment="{TemplateBinding
> Button.HorizontalContentAlignment}"
>                VerticalAlignment="{TemplateBinding
> Button.VerticalContentAlignment}"
>              />
>            </Grid>
>          </ControlTemplate>
>        </Button.Template>
>      </Button>
>  </StackPanel>
> </Window>
>
>
> Build the projet, run it in debug, close the window, modify the file (add
> a
> return anywhere), build and run, you have the bug.
> Only solution i found is force a rebuild and not a build.
>
> Any idea of where it comes from ?
>
> Guillaume



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Resourcedictionary in dll; pack uri no longer working Ralf Ziller Avalon 7 08-25-2008 04:22 AM
ResourceDictionary question Louis Yeung Avalon 0 01-09-2008 08:52 AM
Dynamically Loading XAML ResourceDictionary which includes otherXAML files John Dunn Avalon 0 10-25-2006 11:18 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51