|
I am developing my first WPF app. It has some animations are essentially the same, but with different targets. I want to stagger their execution so they look random. I developed a storyboard for each target and gave each sb a unique name. To insert the delay, I am calling the storyboards from the code-behind. For testing I am using a button for my trigger. Eventually, form_load will trigger the animations. Also for testing purpose, I am only trying to run two storyboards, begin the 2nd one 8 seconds after the first.
My problem is that my storyboards both execution at the same time. After clicking the button, there's an 8 second delay and then they both run. I've tried separating the storyboards in two separate sub's. I've tried dimensioning individual storyboard variables. So far nothing seems to make a difference. I am sure this should be possible. In fact I imagine it's fairly common.
Any help will be appreciated. See code below...
Imports System
Imports System.IO
Imports System.Net
Imports System.Windows
Imports System.Threading
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Navigation
Class Window1
Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
'Call RunStoryBoard("GrowDrop1")
Call RunStoryBoard1()
'Thread.Sleep(800)
Call Delay(8000)
'Call RunStoryBoard("GrowDrop2")
Call RunStoryBoard2()
End Sub
Private Sub RunStoryBoard(ByVal sbName As String)
Dim myStoryBoard As Storyboard = DirectCast(FindResource(sbName), Storyboard)
myStoryBoard.Begin(Me)
End Sub
Private Sub RunStoryBoard1()
Dim myStoryBoard1 As Storyboard = DirectCast(FindResource("GrowDrop1"), Storyboard)
myStoryBoard1.Begin(Me)
End Sub
Private Sub RunStoryBoard2()
Dim myStoryBoard2 As Storyboard = DirectCast(FindResource("GrowDrop2"), Storyboard)
myStoryBoard2.Begin(Me)
End Sub
Public Sub Delay(ByVal Milliseconds As UShort)
Dim DelayTime As TimeSpan
Dim NewTime As DateTime = DateTime.Now.AddSeconds(Milliseconds / 1000)
Do
DelayTime = NewTime.Subtract(DateTime.Now)
Loop While DelayTime.Seconds > 0
End Sub
End Class
|
|
|
|
|
I think I solved my own problem.
Rather than trying to run multiple storyboards, each containing animations for a single target, I tired putting all of the animations for all of the targets into a single storyboard and arrange them on the timeline so they appear to fire in a random order. That seems to be working fairly well.
My only issue now is how to set it up so it runs continuously. What complicates this is that each target has 3 animations associated with it. Each target is a droplet. The first 2 animations are an X and a Y scale transformations, to make the droplet grow. The third is a translate transformation as the droplet falls down the screen. I use this set of 3 animations for each of the droplets. I am not sure yet how to set this up so the animations for a target are repeated automatically in the proper sequence.
If anyone has an ideas on this, again I would appreciate the help.
|
|
|
|
|
I want to develop an application with Menus and Sub menus using WPF.
File (Main menu)
New (Sub menu)
Save (Sub menu)
In Windows Form application i created MDI parent form, on click on "Save" button i would display another Form(child) within the MDI parent Form.
I want to achieve similar functionality with WPF. Do i need to create User Control and on click of "Save" button display the User control?
Or is there any other way i can achieve this.
I'm new to WPF. Please let me know
Thanks
|
|
|
|
|
Hello all of you,
I have a problem and would be glad if you could help me.
What I need to know is how to archieve UserControl inheritance with VB. I found some samples how to do this with C# and all of them work fine with C#. But when I try to translate this in VB I get an error (namespace not found) in my UserControl-XAML.
e.g. this link, Variant 1:
http://svetoslavsavov.blogspot.com/2009/09/user-control-inheritance-in-wpf.html
It seems to be easy in C# and impossible with VB.
This is my approach:
1) the class "TestBaseCtrl.vb"
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Namespace UserControlInheritance
Public Class TestBaseCtrl
Inherits UserControl
End Class
End Namespace
2) the UserControl "InheritedUserControl.xaml"
<local:TestBaseCtrl x:Class="UserControlInheritance.InheritedUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:UserControlInheritance"
Height="300" Width="300">
<Grid>
</Grid>
</local:TestBaseCtrl>
3) the code-behind "InheritedUserControl.xaml.vb"
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Namespace UserControlInheritance
''' <summary>
''' Interaction logic for InheritedUserControl.xaml
''' </summary>
Partial Public Class InheritedUserControl
Inherits TestBaseCtrl
Public Sub New()
InitializeComponent()
End Sub
End Class
End Namespace
My (german) error message is the following:
"Der local:TestBaseCtrl-Typ wurde nicht gefunden. Alle Assemblyverweise müssen vorhanden sein, und alle Assemblys, auf die verwiesen wird, müssen erstellt worden sein."
in english something like this:
"The local.TestBastCtrl-type was not found. All assembly references have to exist and all assemblys, that are referenced, have to be built."
--> It seems to me that the compiler does not find the class in my namespace but I can assure that the namespace is as correct as it is in the C#-project.
Your help would be very much appreciated!
I need a UserControl to inherit from, there are several functions that should be integrated in all of my forms and I do not want to implement them in every form I want to create.
If I get this working, I hope that this kind of UserControls will still be working within the CAL (Composite Application Libary)-Framework, but this will be another story for another day...
|
|
|
|
|
hi guys
i am hosting my wcf service in IIS5 ,but it gives me an error like
An error occurred while trying to make a request to URI 'http://tauseef-pc/wcfhost/Service.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
my wcf service is hosted on iis in a seperate asp.net project and my policy file is
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers= "*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
any help please ...................
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Make sure the policy file is named "clientaccesspolicy.xml".
Make sure the file is located in the folder of the domain's root
(the physical folder "http://tauseef-pc" maps to).
What happens when you navigate to http://tauseef-pc/wcfhost/Service.svc
in a browser?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
oh i got it,
actually i put it on the root of application so it was getting error .
now when i have changed its location to domain root i am getting another error
while debugging it.
"The remote server returned an error: NotFound."
any help please........
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
I would first try to navigate to http://tauseef-pc/wcfhost/Service.svc
in a browser.
If that doesn't work - what's in the web application's web.config file?
If it does work, then maybe just the client side service reference configuration
needs adjusting.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ok , things are working now, but with a little change, the problem is in my method which returns array of type Employee, i came to know i tested it with another method which just returns a string and its working
and the same error still there upon the call of GetEmployeeDataMethod() which returns an array of type employee.
any help please ?
public Silverlight_UI.Service.Employee[] EndGetData(System.IAsyncResult result) {
object[] _args = new object[0];
//error on this line Silverlight_UI.Service.Employee[] _result = ((Silverlight_UI.Service.Employee[])(base.EndInvoke("GetData", _args, result)));
return _result;
}
//my service code
public Employee[] GetData()
{
using (AdventureWorksDataContext dataContext = new AdventureWorksDataContext())
{
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<employee>(m => m.EmployeeAddresses);
dlo.LoadWith<employee>(m => m.Contact);
dlo.LoadWith<employeeaddress>(m => m.Address);
dataContext.LoadOptions = dlo;
var list = from emp in dataContext.Employees
select emp;
return list.Take(10).ToArray();
}
}
it just give me error when i call any method which calls my locadatabase ,i have created a user for apnet ,
but i dont know what to do?
regards.
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
okh, i got it but still thanks.
actually i debug it through flidder and got that there was user permission issue about aspnet user.
i chnaged this user to public and dopwner and now its working.
can you please explain a bit about ?
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Tauseef A wrote: can you please explain a bit about ?
Every process runs as a user identity - that's how the
OS knows what rights/priviliges a process has.
If your database is using Windows authentication then it is using the
user identity of the process calling it. That identity,
therefore, needs the correct permissions for any database tasks it
intends to perform.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks.
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Hi
i was working with ScreenSpaceLines3D (Part of 3DTools for WPF)
and to draw this object i must to add it to Viewport3D.Children which is Visual3DCollection
when i add the object to that collection then remove it it throw a 'NullReferenceException'
the exception was thrown by a method inside the class which is UpdateTransform() in OnRendering eventHandler
cold someone help in this ?
and the other problem that i can not replace ScreenSpaceLines3D with
any thing i must use it
Sample of what happens :
<pre>
Viewport3D viewport;
ScreenSpaceLines3D screenSpaceLines3D;
public void AddLine()
{
screenSpaceLines3D = new ScreenSpaceLines3D();
screenSpaceLines3D.Color = Colors.Blue;
screenSpaceLines3D.Points.Add(new Point3D(0, 0, 0));
screenSpaceLines3D.Points.Add(new Point3D(10, 10, 10));
screenSpaceLines3D.Thickness = 1;
viewport = new Viewport3D();
viewport.Children.Add(screenSpaceLines3D);
}
public void RemoveLine()
{
if (screenSpaceLines3D != null)
{
viewport.Children.Remove(screenSpaceLines3D);
}
}// The exception appears her
</pre>
|
|
|
|
|
is it possible to add transparency to an ModelUIElement3D
ive made a cube and a pie but want to make them transparent..
|
|
|
|
|
Sure - just apply a transparent brush. Brushes provide an alpha component just for this type of case.
"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 | Onyx
|
|
|
|
|
Hi Guys,
Im currenlty a Vb.net developer.
I wanna learn how to use the above technologies.
Which book or site would you suggest should be read to get started!
thanks
Anoop
|
|
|
|
|
Don't know about books, but there's lots of info here:
.NET Framework 3.5[^]
All this same info is in the local help in Visual Studio as well.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello Friend,
For WPF you can see following book.
Windows Presentation Foundation Unleashed, SAMS publications, Author : Adam Nathan
For WWF, Version 4.0 is totally different than version 3.5 . We can say that Microsoft has changed WF totally in 4.0 . And currently no book is available for 4.0 . But you can get Beta2 of WF 4.0 and samples from Microsoft side.
|
|
|
|
|
Hi,
I am working on a WPF application. I want to place table with some lable controls in my form to display data. For this I tried the folowing code.
<FlowDocumentReader Margin="131,133.738,184,217.262" ScrollViewer.HorizontalScrollBarVisibility="Hidden" >
<FlowDocument >
<Table CellSpacing="3" >
<Table.Columns>
<TableColumn Width="80" />
</Table.Columns>
<TableRowGroup>
<!-- Header row for the table. -->
<TableRow Background="Orange">
<TableCell>
<TextBox x:Name="txtTransmiterFee" Width="80" LostFocus="txtTaxPreperationFee_LostFocus"></TextBox>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
Here I am getting some extra features for zooming, scrollbar etc, but I want just a table.
If any one have any idea to place a table control in WPF or amy modifications in this code to display just like a table, please reply me.
Thanks in advance.
|
|
|
|
|
Nekkantidivya wrote: Here I am getting some extra features for zooming, scrollbar etc, but I want just a table.
Maybe you can use a simpler flow document reader like a
FlowDocumentScrollViewer:
<!--<FlowDocumentReader Margin="131,133.738,184,217.262" ScrollViewer.HorizontalScrollBarVisibility="Hidden" >-->
<FlowDocumentScrollViewer IsToolBarVisible="False" Margin="131,133.738,184,217.262" HorizontalScrollBarVisibility="Hidden" >
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark Salsbery,
Thanks for your reply. It helped me and now I am getting table without unnecessary features.
But now the width of the table is fixed and I am unable to increase the width of the tableto the width of the form.
Please reply me if you have any idea to solve this
Thanks in advance.
|
|
|
|
|
Nekkantidivya wrote: now the width of the table is fixed and I am unable to increase the width of the tableto the width of the form.
Wrap the FlowDocumentScrollViewer in an element that resizes its children,
like a Grid or a Window.
For example (borrowing the flowdocument from the documentation), note how resizing this window resizes the table to fit:
<Window x:Class="WPFTester.Window4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpftk="http://schemas.microsoft.com/wpf/2008/toolkit"
xmlns:local="clr-namespace:WPFTester"
Title="Window4" Height="500" Width="500">
<Grid >
<FlowDocumentScrollViewer IsToolBarVisible="False" ><!--<FlowDocumentReader >-->
<FlowDocument>
<Table CellSpacing="5">
<Table.Columns>
<TableColumn/>
<TableColumn/>
<TableColumn/>
<TableColumn/>
</Table.Columns>
<TableRowGroup>
<!-- Title row for the table. -->
<TableRow Background="SkyBlue">
<TableCell ColumnSpan="4" TextAlignment="Center">
<Paragraph FontSize="24pt" FontWeight="Bold">Planetary Information</Paragraph>
</TableCell>
</TableRow>
<!-- Header row for the table. -->
<TableRow Background="LightGoldenrodYellow">
<TableCell>
<Paragraph FontSize="14pt" FontWeight="Bold">Planet</Paragraph>
</TableCell>
<TableCell>
<Paragraph FontSize="14pt" FontWeight="Bold">Mean Distance from Sun</Paragraph>
</TableCell>
<TableCell>
<Paragraph FontSize="14pt" FontWeight="Bold">Mean Diameter</Paragraph>
</TableCell>
<TableCell>
<Paragraph FontSize="14pt" FontWeight="Bold">Approximate Mass</Paragraph>
</TableCell>
</TableRow>
<!-- Sub-title row for the inner planets. -->
<TableRow>
<TableCell ColumnSpan="4">
<Paragraph FontSize="14pt" FontWeight="Bold">The Inner Planets</Paragraph>
</TableCell>
</TableRow>
<!-- Four data rows for the inner planets. -->
<TableRow>
<TableCell>
<Paragraph>Mercury</Paragraph>
</TableCell>
<TableCell>
<Paragraph>57,910,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>4,880 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>3.30e23 kg</Paragraph>
</TableCell>
</TableRow>
<TableRow Background="lightgray">
<TableCell>
<Paragraph>Venus</Paragraph>
</TableCell>
<TableCell>
<Paragraph>108,200,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>12,103.6 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>4.869e24 kg</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>Earth</Paragraph>
</TableCell>
<TableCell>
<Paragraph>149,600,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>12,756.3 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>5.972e24 kg</Paragraph>
</TableCell>
</TableRow>
<TableRow Background="lightgray">
<TableCell>
<Paragraph>Mars</Paragraph>
</TableCell>
<TableCell>
<Paragraph>227,940,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>6,794 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>6.4219e23 kg</Paragraph>
</TableCell>
</TableRow>
<!-- Sub-title row for the outter planets. -->
<TableRow>
<TableCell ColumnSpan="4">
<Paragraph FontSize="14pt" FontWeight="Bold">The Major Outer Planets</Paragraph>
</TableCell>
</TableRow>
<!-- Four data rows for the major outter planets. -->
<TableRow>
<TableCell>
<Paragraph>Jupiter</Paragraph>
</TableCell>
<TableCell>
<Paragraph>778,330,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>142,984 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>1.900e27 kg</Paragraph>
</TableCell>
</TableRow>
<TableRow Background="lightgray">
<TableCell>
<Paragraph>Saturn</Paragraph>
</TableCell>
<TableCell>
<Paragraph>1,429,400,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>120,536 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>5.68e26 kg</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph>Uranus</Paragraph>
</TableCell>
<TableCell>
<Paragraph>2,870,990,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>51,118 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>8.683e25 kg</Paragraph>
</TableCell>
</TableRow>
<TableRow Background="lightgray">
<TableCell>
<Paragraph>Neptune</Paragraph>
</TableCell>
<TableCell>
<Paragraph>4,504,000,000 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>49,532 km</Paragraph>
</TableCell>
<TableCell>
<Paragraph>1.0247e26 kg</Paragraph>
</TableCell>
</TableRow>
<!-- Footer row for the table. -->
<TableRow>
<TableCell ColumnSpan="4">
<Paragraph FontSize="10pt" FontStyle="Italic">
Information from the
<Hyperlink NavigateUri="http://encarta.msn.com/encnet/refpages/artcenter.aspx">Encarta</Hyperlink>
web site.
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</FlowDocumentScrollViewer>
</Grid>
</Window>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ok, I have a Silverlight application and I am trying to receive message events from a stand alone Windows Workflow (state machine). Now I am pretry sure that this can be done using a duplex service. However, the issue is not with the service that will live on the WF side, but with our service that is going to live in Silverlight app. We are trying to develop a service that will complete a "handshake" with the workflow in order to tell the flow what activity messages we want and then have our silverlight app listen for those specific messages and then receive those messages. If anyone can help that would be great. Also I do understand that Silverlight does not support Windows Workflow. These two applications will run independently of eachother. This will be a Live message update scenario.
Thanks, I hope someone can help!!
Aspiring Code Monkeys
I can also be reached at my personal email at c.topher.clay@gmail.com
|
|
|
|
|
Hi all,
I used to use .Net application for all our web application. I did not really interested to do silverlight buiness application dispite it is very cool and the UI is nice.
i had an argument with one of my collegue. he is saying that we can use silverlight Biz. application instead of our web application for our development. but what i am saying that silverlight is not much sopheticated to be able to develop huge application. it is designed for small and basic applications only.
this was our agrument. i tried to find out comparision between silverlight Business Application and Web Application. i could not find.
thats why i am posting my question here which is:
Can we use SilverLight Business Application to do all our web applications
Hussain Mohammed Saleh Attiya
ISP Technical Manager
Atyaf Telcom - Bahrain
|
|
|
|
|
hussain.attiya wrote: i tried to find out comparision between silverlight Business Application and Web Application.
Maybe an understanding of what Silverlight is would help
to start with...
What is Silverlight?[^]
What do you mean by "web application"?
What is "SilverLight Business Application"? Do you mean the
project template that comes with the Silverlight 3.0 development
tools?
Silverlight is implemented as a browser plugin (like Flash) so Silverlight
applications run on the client side. Silverlight can be hosted on any web page
including web pages from ASP.NET web applications.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|