|
Hi everyone. I might be missing something obvious, but after I run a simple WPF storyboard to animate an object's width, I am no longer able to change the width manually. I have created the simple example below to demonstrate my point. The width change done by the first button works before you animate with the second button, but not after.
What am I missing here? How can I "unfreeze" my width property so I can set it again?
XAML:
<Canvas>
<Button Click="Button_Click">
Set width to 100
</Button>
<Button Canvas.Top="30"
Animate width to 250
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="RedRectangle" Storyboard.TargetProperty="Width" To="250" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
<Rectangle Name="RedRectangle" Width="25" Height="25" Canvas.Top="70" Fill="Red" Stroke="Black" />
</Canvas>
C# code behind:
private void Button_Click(object sender, RoutedEventArgs e)
{
RedRectangle.Width = 100;
}
Thanks in advance
Josh Fischer
|
|
|
|
|
Found the answer to my own question: FillBehavior="Stop"
http://msdn.microsoft.com/en-us/library/aa970493.aspx
Josh Fischer
modified on Wednesday, December 10, 2008 10:23 AM
|
|
|
|
|
|
[WPF 3.5 SP1] is there any way to place a DependencyProperty in a base class so that if you have a set of usercontrols (with the same base) and each of those controls acting as a Routed Template and you had a for instance that you were binding a Title DependencyProperty to...
Templates being: XceedSubControl_3D
XceedSubControl_Standard
Since you have to have specify [typeof(XceedSubControl)] when the DependencyProperty is registered...and each of your templates have a different name how would you go about this? The DependencyProperty itself compiles fine but binding fails.
public class SubControlBase : UserControl { public static DependencyProperty TitleProperty = DependencyProperty.Register( "Title", typeof(String), typeof(XceedSubControl),
Thoughts or insights would be appreciated.
|
|
|
|
|
hi evrybody
i try to do task by WPF for trying the work with WPF enviroment
i try to add combobox in gridview but i dont know how can i bind or fill combobox in xaml
i wrote this but not enough
<ListView Width="Auto" ItemsSource="{Binding}" Height="Auto" IsSynchronizedWithCurrentItem="True">
<ListView.View>
<GridView>
<GridViewColumn Header="Gender ID" Width="120">
<GridViewColumn.CellTemplate>
<DataTemplate >
<TextBox Margin="0,0,0,0" Text="{Binding Path=GenderID}" Width="100"></TextBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Gender Type" Width="120">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox Name="Combo_Type" ItemsSource="{Binding Source={}" DisplayMemberPath="{Binding Path=GenderType}" Width="100"></ComboBox>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
MD_NADA
|
|
|
|
|
It sounds like you want to use an enum for the items source of your combobox, so this article should be a good starting point. You will probably want to bind SelectedItem="{Binding Path=GenderType}" instead of DisplayMemberPath.
|
|
|
|
|
thanks for reply
but this not working
in fact the GridView Bind to CollectionView and i want to fill the combobox in GridView by the binding to anothet table , i know how can i do this in windows forms but in WPF i see i can set binding in xaml
i hope i show this point clearly
MD_NADA
|
|
|
|
|
Hi!
I need to implement a few UserControls in WPF. Since they all have some common functionality I want to create a base class from which they would all derive. The problem is that UserControl has to extend the UserControl class and there is no multiple inheritance in c#. Does anybody know a good way around this problem? Every advice will be appreciated!
Uros Bregar
|
|
|
|
|
You just use an inheritance chain
Create your base class inheriting from the UserControl class
MyBaseControl : UserControl
Then your control inherits from your base class, simple (If I understood the question correctly
ActualControl : MyBaseControl
|
|
|
|
|
I guess i didn't explain my problem well enough. When you create a user control in visual studio, you actually get three files. .cs, .xaml and .g.cs(when using xaml and c#). When you change the base class of the partial class defined in .cs file, you have to do the same for the class defined in the .g.cs file, since partial classes have to have the same base class. The problem is that the .g.cs file is auto-generated by VS and gets changed every time the content of the xaml file is re-compiled.
Uros Bregar
|
|
|
|
|
Is this what you're looking for?
namespace MyNamespace
{
public partial class MyUserControlBase : UserControl
{
public MyUserControlBase()
{
}
}
public partial class MyUserControl : MyUserControlBase
{
public MyUserControl()
{
InitializeComponent();
}
}
}
<local:MyUserControlBase x:Class="MyNamespace.MyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyNamespace"
Height="300" Width="300">
<Grid>
</Grid>
</local:MyUserControlBase>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
In my WPF application I have a requirement where in user can drag-and-drop an email (.msg file) either from the file system OR MS Outlook. When user drags-and-drop the .msg file from the file system the file gets added. But when user drags-and-drop a .msg file from MS Outlook, it throws following exception
Exception from HRESULT: 0x80040068 (DV_E_LINDEX
I have implemented the below code & I encounter error on below line
MemoryStream ms = (MemoryStream)e.Data.GetData("FileContents", true);
string[] fileNames = null;
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
{
fileNames = e.Data.GetData(DataFormats.FileDrop, true) as string[];
foreach (string fileName in fileNames)
{
FileInfo fileInfo = new FileInfo(fileName);
}
}
else if (e.Data.GetDataPresent("FileGroupDescriptor"))
{
Stream theStream = (Stream)e.Data.GetData("FileGroupDescriptor");
byte[] fileGroupDescriptor = new byte[512];
theStream.Read(fileGroupDescriptor, 0, 512);
StringBuilder fileName = new StringBuilder("");
for (int i = 76; fileGroupDescriptor[i] != 0; i++)
{
fileName.Append(Convert.ToChar(fileGroupDescriptor[i]));
}
theStream.Close();
string path = Path.GetTempPath();
string theFile = path + fileName.ToString();
MemoryStream ms = (MemoryStream)e.Data.GetData("FileContents", true);
byte[] fileBytes = new byte[ms.Length];
ms.Position = 0;
ms.Read(fileBytes, 0, (int)ms.Length);
FileStream fs = new FileStream(theFile, FileMode.Create);
fs.Write(fileBytes, 0, (int)fileBytes.Length);
fs.Close();
FileInfo tempFile = new FileInfo(theFile);
if (tempFile.Exists)
{
tempFile.Delete();
}
What might be the issue here? Kindly help.
Regards,
Vipul Mehta
|
|
|
|
|
I'm using ComponentOne Grid for WPF with VS2008 SDK 3.5, and Iam recieving the following error when I compile a project:
Error 1 Task failed because "LC.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "LC.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5. 2) Install Visual Studio 2008. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the "ToolPath" parameter of the task.
This comes after I add the third party control to a form. If I don't add the control and run the project after creating a new project(WPF Application) it runs fine. I can't find the the "ToolPath" parameter also. I tried uninstalling and reinstalling the SDK and Component One but it gave the same error.
Is this a problem with the project, or the third party stuff???
Best Wishes ....... ARIJIT
|
|
|
|
|
Have you asked ComponentOne?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I would get in touch with ComponentOne and raise a support call on this. LC.exe generates a .NET license file to add to the manifest, so I would be asking them why you need to add the license file.
|
|
|
|
|
HI all,
i need a feature about add,edit and delete a record ,in few words my boss request to insert a password when a employee will add,delete and edit a record but i have not idea how do that.
Do you have advices ,ideas or some link to see how apply this feature.
I use Wpf with Linq toSQL .
Thanks for your attention.
I wish you happy work.
Best regards,
Bye
|
|
|
|
|
Do you mean that a user should login to your app at startup or enter a password on a single window at the same time as submitting these new/changed details?
I'd opt for having a login when the app started personally.
Does the database your using already have any form of user login/security mechanism? If not, this isn't a trivial thing to implement.
|
|
|
|
|
Hi JAmmer,
firstly thanks to reply me,
my database hasn't a security or better i did not put a password in my SqlServer
Jammer wrote: Do you mean that a user should login to your app at startup or enter a password on a single window at the same time as submitting these new/changed details?
I mean (my boss request ) that when a employee will add,delete or edit a record before to perform that action must appear a password to complete the action (add,delete,edit) ,he is a little pedantic because he got afraid that somebody will change the data without his permission .
I'm interested having a login when the app start ,can you explain me more in detail about this option?
Thanks
I wish you happy day.
Best Regards,
Bye
|
|
|
|
|
If you want to have a login at app start your going to have to implement some form of security database.
This is a fair sized project in its own right.
You'll have to authenticate users at login, store hashed passwords and possibly implement some form of 'user roles' that have a selection of permissions regarding things they are allowed to do and things they aren't allowed to do.
If your going to all this trouble you should also be logging what a user does, when they did it etc ...
Sounds to me like you would be wise to actually tell your boss that this is potentially a lot of work.
Its the kind of infrastructure thing that needs planning and doing in such a way that it is application independant as well. So any future apps you develop can also make use of this security model.
This is also drifting way off topic for this forum!
|
|
|
|
|
The advice that Jammer has given you is good stuff, but there is something else you can do. In ASP.NET, there is the concept of something called the Membership and Role Providers, which are used to provide authentication on a website. There's a common misconception that they can only be used on a website - this just isn't true. With a little bit of work, you can hook up a desktop application to use the same infrastructure.
Here's[^] a Win Forms example that should be relatively easy to port over.
|
|
|
|
|
Thats really interesting ...
Thanks for that Pete.
|
|
|
|
|
Hi,
Thanks for your fast reply,
i will look right now the link and after i will try ,however i will tell you if i try difficult or not.
A special warm hug...so far so good.
I wish you happy day.
Best Regards,
Bye
|
|
|
|
|
|
Thanks a lot for your lovely support.
when i will develop it i will tell you how is it..
i wish you happy day.
Best regards,
Bye
|
|
|
|
|
Hi
I'm looking for an IP Text box implementation, either with a mask or windows style (4 boxes, with the abillity to copy\paste etc)
Any one has done it before?
Thanks,
|
|
|
|