Same.. Shared... there you go... now for extra bonus points, what does the Shared attribute do under the hood... mmmm...mmmmmmmmmm
--- Regards, Scott Barnes http://www.riagenic.com On Mon, Dec 12, 2011 at 1:43 PM, Stephen Price <[email protected]>wrote: > I knew that! > > No, just kidding. News to me too. ;) > > Awesome! > > On Mon, Dec 12, 2011 at 1:35 PM, Patrick Klug <[email protected]>wrote: > >> I did not know this. Excellent info. Thanks Matt! >> >> cheers, >> Patrick >> >> >> On Mon, Dec 12, 2011 at 11:52 AM, Matt Hamilton <[email protected]>wrote: >> >>> Steve, >>> >>> Set your style to be non-shared so it has its own instance across both >>> expanders: >>> >>> <Style x:Key="ExpanderStyle" x:Shared="False" TargetType="Expander"> >>> >>> HTH, >>> Matt >>> >>> *From:* Steven Nagy <[email protected]> >>> *Sent:* Monday, December 12, 2011 12:21 PM >>> *To:* [email protected] >>> *Subject:* Expander Header via style throws error >>> >>> >>> Hiyas,**** >>> >>> **** >>> >>> Really simple to recreate this issue, just paste in this code to a new >>> WPF project:**** >>> >>> **** >>> >>> <Grid> **** >>> >>> <Grid.RowDefinitions>**** >>> >>> <RowDefinition Height="*" />**** >>> >>> <RowDefinition Height="*" />**** >>> >>> </Grid.RowDefinitions>**** >>> >>> <Grid.Resources>**** >>> >>> <Style x:Key="ExpanderStyle" TargetType="Expander">**** >>> >>> <Setter Property="Header">**** >>> >>> <Setter.Value>**** >>> >>> <Grid>**** >>> >>> <TextBlock Text="Foo" />**** >>> >>> </Grid>**** >>> >>> </Setter.Value>**** >>> >>> </Setter>**** >>> >>> </Style>**** >>> >>> </Grid.Resources>**** >>> >>> **** >>> >>> <Expander Style="{StaticResource ExpanderStyle}" />**** >>> >>> <Expander Style="{StaticResource ExpanderStyle}" Grid.Row="1" /> >>> **** >>> >>> </Grid>**** >>> >>> **** >>> >>> Essentially, 2 expanders using the same style to set the header.**** >>> >>> **** >>> >>> Throws this exception: *“'Set property >>> 'System.Windows.FrameworkElement.Style' threw an exception.' Line number >>> '23' and line position '10'”* >>> Inner exception: *“Specified element is already the logical child of >>> another element. Disconnect it first.”***** >>> >>> **** >>> >>> However if you sacrifice the complex header content for something simple >>> like this, it works fine:**** >>> >>> <Setter Property="Header" Value="Foo" />**** >>> >>> **** >>> >>> Any ideas why this is the case?**** >>> >>> Using style inheritance from the same base style causes same issue.**** >>> >>> However if I blanket copy paste the style with a new name and point the >>> expander to that, then it also works fine. So it’s not the header content >>> that’s the problem specifically.**** >>> >>> I’m guessing some sort of virtualisation similar to what the tab control >>> does with tab pages under binding scenarios; it is using the same actual >>> Grid control and applying it to both headers, thus the inner exception >>> above. No idea how to fix it though (other than copying pasting styles >>> which I really don’t want to do).**** >>> >>> **** >>> >>> Cheers,**** >>> >>> Steve**** >>> >>> **** >>> >>> ------------------------------ >>> _______________________________________________ >>> ozwpf mailing list >>> [email protected] >>> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf >>> >>> >>> _______________________________________________ >>> ozwpf mailing list >>> [email protected] >>> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf >>> >>> >> >> _______________________________________________ >> ozwpf mailing list >> [email protected] >> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf >> >> > > _______________________________________________ > ozwpf mailing list > [email protected] > http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf > >
_______________________________________________ ozwpf mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
