|
I can't get u Abinav.Could you just give me the code.Thanks
|
|
|
|
|
|
Sample is fine.But,it wont find out if u enter numerics in text column.I need the entire code for that.When I click the button,it should check the values in textboxes and it should display.Could u help me?thanks
|
|
|
|
|
|
The samples you've been shown show how you can use Silverlight
validation.
You can change the samples to fit your needs.
You could loop through the strings using Char.IsDigit()/Char.IsLetter().
You could also use regular expression matching
bool isalldigits = Regex.IsMatch(inputstring, @"^([0-9]+)$");
bool isallletters = Regex.IsMatch(inputstring, @"^([a-zA-Z]+)$");
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
make an event handler for key_up. Attach it to the numeric data boxes. You still need to validate the data but this will make it easier on the user.
|
|
|
|
|
Hi folks!
Can anyone please help me with this:
I have two values (one manual input and one from a database) and I need to compare them/ validate them via ValidationRules and show errors if they do not match.
LOGIC: V1 == V2 => OK
V1 != V2 => NOK, Error
<TextBlock>
<TextBlock.Text>
<Binding ...>
<Binding.ValidationRules>
<localValidation:ValidateIt V1={Binding Path=...} V2={Binding Path=}/>
</Binding.ValidationRules/>
<TextBlock.Text/>
</TextBlock>
where
public class ValidateIt : ValidationRule
public int V1 {get;set;}
public int V2 {get;set;}
Unfortunately it tells me, that V1 and V2 cannot be bound due to the fact, that these are no DependencyProperties.
I'm stuck...
Thanks in advance,
eza
|
|
|
|
|
They don't need to be DependencyPropety's to be bound. There's a lightweight way of achieving what you want using POCO's. If you take a look at my sample here[^], you'll see that I'm handling the validation based on a ViewModel, which is totally none-DP based.
"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
|
|
|
|
|
Why not function?
please!
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
Title="Window1" Height="300" Width="300">
<Grid Name="Grid1">
<Button Height="25" Width="50"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Name="Button1">Go</Button>
</Grid>
</Window>
Imports System.Windows.Media.Animation
Class Window1
Private LL As New Windows.Controls.Label
Private Sub Window1_Loaded(ByVal sender As Object, ByVal
e As System.Windows.RoutedEventArgs) Handles Me.Loaded
LL.Content = "dgkdjsjfklògjsòldfg"
LL.Name = "Label1"
LL.HorizontalAlignment Windows.HorizontalAlignment.Left
LL.VerticalAlignment Windows.VerticalAlignment.Top
LL.Foreground = Brushes.Black
LL.Visibility = Windows.Visibility.Visible
Me.Grid1.Children.Add(LL)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.Windows.RoutedEventArgs) Handles
Button1.Click
Dim sb As New Storyboard
Dim myDoubleAnimation As New DoubleAnimation
myDoubleAnimation.From = 0
myDoubleAnimation.To = 100
myDoubleAnimation.Duration TimeSpan.FromMilliseconds(2000)
Storyboard.SetTargetName(myDoubleAnimation,
"Label1")
Dim PropP As New PropertyPath(Canvas.LeftProperty)
Storyboard.SetTargetProperty(myDoubleAnimation,
PropP)
Dim myDoubleAnimation2 As New DoubleAnimation
myDoubleAnimation2.From = 0
myDoubleAnimation2.To = 100
myDoubleAnimation2.Duration TimeSpan.FromMilliseconds(2000)
Storyboard.SetTargetName(myDoubleAnimation2,
"Label1")
Dim PropP2 As New PropertyPath(Canvas.TopProperty)
Storyboard.SetTargetProperty(myDoubleAnimation2,
PropP2)
sb.Children.Add(myDoubleAnimation)
sb.Children.Add(myDoubleAnimation2)
Me.BeginStoryboard(sb)
End Sub
End Class
|
|
|
|
|
What does 'not working' mean ? We're not going to run your c ode to try to work that out. Have you debugged it ? What do you expect to happen ? What does happen ? Where does it go wrong ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
I develop a custom control in VS 2008 and in that control is a DP property of a custom class.
The class has mainly two DP properties of type System.Globalization.CultureInfo and System.Globalization.Calendar . The class derives from DependencyObject .
So when in design time I choose a value for the class, the designer generates xaml code similar to:
<CustomControl.Culture>
<Culture Culture="Deutsch (Deutschland)">
<Culture.Calendar>
<my:GregorianCalendar />
<Culture.Calendar>
</Culture>
</CustomControl.Culture>
But what I want is following:
<CustomControl.Culture>
<Culture Culture="Deutsch (Deutschland)" Calendar="Gregorian Localized">
</Culture>
</CustomControl.Culture>
I adorned the Calendar DP property in the custom class with a TypeConverterAttribute and an ValueSerializerAttribute and built a design dll adding the attributes to the metadata store but nothing is working.
If I write the code in xaml in the second form the designer accepts it and all is fine, but every time
I change the Calendar property in the property browser, the designer changes the code to the first form.
If I implement the custom class derived from object without DP properties, the designer generates code in the second form.
Any ideas if I can influence the designer generated code?
Thanks,
Thomas.
|
|
|
|
|
hi guys
i have to start a new project (silverlight based), but i am unable to find a standard and latest design structure,
should i use L2s or EF, i want to follow to n-tier architecture ,there are many sample applications i have seen but there
WCF services are included in the web application why ?but i want my WCF services in the separate project ,
am i thinking in a right way ? please any help , thanks , regards.
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Silverlight is strictly client-side technology.
WCF and other web services are server side.
You don't have to host your web services in the same web
application that hosts the Silverlight application.
In fact, Silverlight apps don't need to be hosted in web
applications at all.
For n-tier, how you connect your client and server tiers is
up to you. You have some options built-in:
Accessing Web Services in Silverlight[^]
For EF you get even more help built-in:
WCF RIA Services[^]
Even though WCF RIA Services is still beta, the Visual
Studio 2008/Silverlight 3 version has a go-live license. I
use it in production applications and it works great - saves
a ton of plumbing code usually needed for typical n-tier/CRUD
type stuff.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
Our company planing to develop application using sliverlight. since user can use both desktop(standalone) and web(cross browser)
I would like to all feasibility. Sliverlight Is it correct choice? and what are advantage and disadvantage. While installing into desktop from web, do we face some issue?
Regards
Gopal
|
|
|
|
|
If you can do without a full trust application, Silverlight is a
good choice. You can write one app that will run on Win PCs and
Macs, online or offline.
Silverlight has out-of-browser support, which isn't quite the same
as a stand-alone application. You don't get anything special running
out-of-browser beyond the ability to run without a network connection.
The same security restrictions apply, and you're still using the
Silverlight .NET framework, not the full .NET framework.
Silverlight 4 apps will be able to run out-of-browser with elevated
privileges....for more info see Silverlight 4 Beta – A guide to the new features[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I will suggest you to use Silverlight if you are planning to use it for web application. If you want to target it for a desktop application I will suggest you to prefer WPF.
To run a WPF application the user requires .Net framework which is around 256MB & Silverlight plugin requires only 4-5MB.
In other hand if you are targeting for web application & some users for standalone application, use Silverlight with OOB support. In OOB though you will not get all the security privileges but you can do best of the things. Silverlight 4 OOB has a huge support for security. So, you can use Silverlight 4 to implement your app. Be sure that, Silverlight 4 is now in Beta stage & hence it does not have any go-live license.
Regards,
- Kunal Chowdhury ( My Blog)
|
|
|
|
|
Hi
Thanks for your info. Suppose our web application using db(sql) which is there in separate server and accessing db through WCF which is hosted in IIS. if I develop through silverlight its work fine. if want to conver OOB will i get problem? since our company don't want to create another destop application.
Regards
Gopal
|
|
|
|
|
This won't be a problem for silverlight.
|
|
|
|
|
Silverlight can help you avoid update issues that often occur with traditional desktp client type applications.
There are decent workarounds (like click once deployment) to overcome these deployment issues, but if you do not want to get into them, Silverlight can be a good choice.
|
|
|
|
|
You can go with Silverlight...
Regards,
- Kunal Chowdhury ( My Blog)
|
|
|
|
|
OK -- I read through the replies and thought I'd add my 2cents worth.
Silverlight is very good if you have a development staff that is more WinForm-centric but needs to do web development. There is a learning curve for XAML, but it is worth it.
The learning curve for XAML is lessened if you also invest in Expression Blend. I actually feel that you cannot develop Silverlight without it, as it gives you the WYSIWYG interface that WinForm developers lean towards.
The application is stateful even though it is a web app. It also follows much of the WCF construct but uses a lighter-weight framework. The idea is that even if a machine does not have the .NET framework on it, the Silverlight install will implement what is needed. The concept works well in theory but in practicallity you still need the Silverlight Toolkit which also has to be installed on the implementing machine, as this contains controls not in the Silverlight framework.
The previous statement, as you can see, is both a pro and con of Silverlight deployment. Using controls outside of the framework requires some additional installations.
I personally find Silverlight to be the easiest way to deploy web applications without having to learn the 4-inch-thick ASP.NET book. It keeps me more in my knowledge base of service/form development. I also find that I can do better UI development. For example, I have a customer maintenance program where the customer can have 3 different types of data to maintain. Using the Swivel behaviour, I was able to keep the UI VERY clean and gives the user a 'cool' UI experience. Clicking a button to view billing address swivels the customer address around to display the billing address. Clicking the return button swivels things back.
|
|
|
|
|
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...
|
|
|
|