|
|
|
All you have done is define DataTemplates and ContentPresenters incorrectly.
You can almost think of statements like
<myC:WindowContainerControl>
As HTML #include statements. So trying to do things like:
<myC:WindowContainerControl>
<Grid>
<ContentPresenter Margin="3" Content="{TemplateBinding Property=Content}"/>
</Grid>
</myC:WindowContainerControl>
Is a bit weird really. If you want to do that you would have the control presenter *inside* the WindowContainerControl.
Take a step back and have a play with WPF in Blend before moving onto stuff like this, just a couple of days to get your head into the way it works the binding is really complex and not hugely intuitive to start with.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
It's good i know that i didn't understand well the mechanism of template-ing and it;s not some bug or something like that. i will study deeper the subject. finally i solved my problem in a different approach.
Once again thanks for your help..as for me i'll do some blending )
|
|
|
|
|
Hi Everybody!
WPF is a great Framework. I love it!
My problem:
I created some polyline objects with Blend, exported and placed them into my window with a grid.
Now I resized my window and my objects resized too, but not as I would like it.
The objects moved in all directions. It looks ugly...
I want to achive a resizing method like stretching an image. Several parts should by resized or stretched as a whole. Maybe resizing the buffer where the objects are rendered?
Do you have a solution or idea?
Thank you!
|
|
|
|
|
|
Thank you! I tried it.
But how to put multiple objects (Images, polylines etc.) into one ViewBox?
|
|
|
|
|
Viewbox can only have one child so use something like a Canvass.
I was just having a play around in Blend to knock up a demo for you but I'm seeing some REALLY odd behaviour with a Viewbox here so it may have to wait a while until I can figure out what is going on here.
I've used Viewbox's with complex/multiple path objects before with no problems.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Lob this into a window and have a play around ...
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MultipleItemsInViewbox.Window1"
x:Name="Window"
Title="Window1"
Width="200" Height="200">
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<Viewbox Grid.Row="0" Grid.RowSpan="1" Stretch="UniformToFill">
<Canvas Width="200" Height="200">
<Path Fill="#FF008C38" Stretch="Fill" Stroke="#FF000000" Width="97.458" Height="76.636" Canvas.Left="23" Canvas.Top="33.172" Data="M23,53 L44.5,94.5 C44.5,94.5 108.5,131.5 110.5,86.5 112.5,41.5 136.5,40.500057 96.5,38.500066 56.5,36.500075 48.499938,26.500119 38.499962,40.500056 28.499987,54.499992 23,53 23,53 z" StrokeThickness="4"/>
<Path Fill="#FF66FF00" Stretch="Fill" Stroke="#FF000000" StrokeThickness="4" Width="99.03" Height="95.15" Canvas.Left="78.394" Canvas.Top="25.137" Data="M95,63 C95,63 145,0 161,41 177,82 182,84.000101 164,100.00018 146,116.00025 146.00007,127.0003 113.00002,109.00022 79.999981,91.000132 92.999997,61.999804 82.999985,66.999801 72.999972,71.999797 95,63 95,63 z"/>
</Canvas>
</Viewbox>
</Grid>
</Window>
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Thank you!
|
|
|
|
|
|
|
Thanks Pete!
I've looked through the "WPF Unleashed" book by Adam Nathan and it doesn't mention this at all, it's too cool a technique to not share it!
I think the best thing about it is that it provides an even nicer way to *really* get into the design side of complex DataTemplates through the use of Expression Blend. Using the 'inline' method your still left in the dark in terms of how your DataTemplate is *actually* going to look.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi. I've created a silverlight applicatin in VS 2008. Now I've created a simple login control containg two text boxes & a Button. Now i've added this user control in the Page.Xaml page. In asp.net application, I've added a default.aspx page & put following code in the html part -
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div style="height: 100%;" id="g">
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/Debug/Vista Style Button.xap"
MinimumVersion="2.0.30523" Width="100%" Height="100%" />
</div>
now i want to access values of two text boxes in the Page_Load Event of the Default.aspx. Can any one help me?
|
|
|
|
|
Why do you want to do that? If you are using textbox in Silverlight, you should access those values from Silverlight. Why do you want to get those values from ASP.NET?
|
|
|
|
|
Hi All! I want to record audio using silverlight. can any one has idea about it?
|
|
|
|
|
|
|
I'm building my own WPF control. Once added to a Window in design mode the control needs to set some of its properties dynamically based on the Window. In code behind I'm doing this:
Foo = "Some dynamic Value";
So I don't loose the new value I want the XAML updated to:
< providercontrol x:name="Control1" foo="Some dynamic Value" >
Much to my dismay the XAML isn't updating. So far my attempts at this will update the property value in the Properties window but the XAML remains unchanged. Without saving my change to the XAML the value is lost when the Window is closed.
How can I change a property inside the control and have the XAML reflect that?
modified on Tuesday, July 22, 2008 7:18 PM
|
|
|
|
|
I'm a bit confused by your question. What exactly are you expecting to see changed in the XAML?
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
If I change a property from it's default I expect that change to be reflected in the XAML. Currently it is not. I change a property on the control and the XAML the doesn't change at all.
I want to see the XAML updated just the same as if I updated a property on the control using the Properties window.
|
|
|
|
|
Which properties window? Visual Studio? Expression Blend?
Which properties are you changing? What control are you working with?
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Sorry, I'm working with Visual Studio. I'm writing my own User control. While that control is running in design time it's going to collect some information such as its parent window code file location. So once the control is placed on the window it is going to fill in my custom string property ParentWindowPath.
Once my property ParentWindowPath changes from its default, that new value should show up in the XAML. However, the XAML never sees the change.
Now if I select my control on the designer, the Visual Studio Properties window does display the new value. From this know my property is being correctly set.
|
|
|
|
|
I've never seen XAML 'change' ... irrespective of what properties I set in C# ...
Are you expecting to see something like MyCustomPropertyName="" become MyCustomPropertyName="C:\windowlocation\window.xaml.cs" in your XAML file??
Have a read of this:
http://msdn.microsoft.com/en-us/library/ms753197.aspx[^]
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Jammer wrote:
Are you expecting to see something like MyCustomPropertyName="" become MyCustomPropertyName="C:\windowlocation\window.xaml.cs" in your XAML file??
Yep, that's exactly what I'm shooting for. It's also exactly the behavior I see if I change MyCustomPropertyName="" to MyCustomPropertyName="C:\windowlocation\window.xaml.cs" using the Properties window.
Since my changes in c# show up in the Properties window I expected them to show up in the XAML as well.
|
|
|
|