|
I m working using silverlight web application. I have 3 group box and those are arranged one by one. Each groupbox have the set of textboxes with an tabindex incremented by one. the problem is if I press the tab key when I am in the focus of last control of first groupbox and focus is disappeared. Actually it supposed to focus to the first input control of second groupbox. but only press again the tab key, it focuses to the first input control of second groupbox. so this process should be same as second to third groupbox.
can anyone please solve this?
advance thanks for your help.
G Nathan
|
|
|
|
|
Hi,
I want to use MVVM approach to achieve something like below:
I have a MainWindow where i have a 3 Buttons like: a)Customers b) Orders c) Sales
By clicking on button, it should open its respective window/usercontrol xaml with customers details,orders details,sales details.
I have tried everything but culdnt able to do so.
How to achieve this using MVVM pattern. Kindly provide the solution?
Thanks
|
|
|
|
|
tarun23 wrote: Kindly provide the solution?
That honestly would be hard as a lot of code will need to be written.
What you can do is create 3 view / view models for customers, orders and sales and launch them separately on each of the three button clicks. You should also take a look at some of the view/view model samples available on the internet.
You might want to post what you have tried so far so that others can go through it and tell you what might be missing.
|
|
|
|
|
Thanks for the reply. I am not getting where to bind the customer button that I placed in the MainWindow.xaml in xaml or some cs file. I have this hierarchy: in View folder -- Customer.xaml file
in ViewModel folder -- CustomerViewModel.cs
in root -- MainWindow.xaml. In this, I have the Customer Button
I am using RelayCommand.cs to fire the button click event
In CustomerViewModel.cs file, I have put
public class CustomerViewModel
{
public RelayCommand CustomerCommand
{
get { return new RelayCommand(param => { return true; }, param => { OpenCustomer(); }); }
}
private void OpenCustomer()
{
//some code }
}
Kindly Suggest,
Thanks.
|
|
|
|
|
tarun23 wrote: . I am not getting where to bind the customer button that I placed in the MainWindow.xaml in xaml or some cs file.
You will bind the button to a commmand that will be placed in the datacontext of your MainWindow.xaml.
(probably MainWindowViewModel.cs or CustomerViewModel.cs).
|
|
|
|
|
How to declare the datacontext of my view in viewmodel in my case. Kindly suggest.
Thanks
|
|
|
|
|
You don't set the datacontext of a view in the viewmodel. What you do, and there are many versions to this, is declare the VM as the DataContext of the view. How you do it depends on how comfortable with the different mechanisms of binding available, e.g. you could set it in the View XAML, or in the code behind. Supposing you set it in the code behind, you set it using something like this:
private MainWindowViewModel _mmvm;
private void SetupViewModel()
{
_mmvm = new MainWindowViewModel();
DataContext = _mvvm;
} Then all you need do is call this method, and you have hooked it up.
"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
|
|
|
|
|
Thanks for the reply. I am new to this MVVM design pattern so i am not getting exactly where to put what. and how to call the commands and all. Also where to set datacontext of what window. Kindly suggest? Thanks
|
|
|
|
|
You would call this method immediately after the call to InitializeComponent(); in the code behind. In order to bind to a command, you simply need to use Binding as in Command="{Binding MyCommand}" where MyCommand is the name of a command that implements ICommand in the VM (note that RelayCommand implements ICommand).
"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
|
|
|
|
|
I'm writing a SL3 app that uses the Silverlight Data Visualization Toolkit. A new version of the toolkit was released in April that added stacked series, but only added it for the SL4 version of the toolkit. I've tried a couple of different ways to reengineer the stacked series to workmin SL3:
0) Copy the entire set of Data Visualization folders from the SL4 version to the SL3 version. This resulted in a compiler error involving SL4 (the Fallback property in a class I don't remember - maybe IEnumerable, but I'm not sure). I abandoned this one when I started getting SL4-specific errors
1) Copy JUST the files I need from the SL4 version to the SL3 version. This actually compiled clean, but it throws a null reference exception that I'm finding it difficult to track down. I think I want to try to stick with this approach, because it looks like I'm closer to success with it.
I can transfer all of the files to whoever would like to look at it if we can figure out a transfer mechanism (maybe creating an unfinished article and provided the code as the article download.)
EDIT ======================
Here's a more complete descrioption of the problem:
http://forums.silverlight.net/forums/p/187997/431306.aspx#431306[^]
I've got to have this fingered out by noon today (3.5 hours from now), or work on it after hours and on weekends.
.45 ACP - because shooting twice is just silly----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Tuesday, June 22, 2010 9:29 AM
|
|
|
|
|
I had tried fixing a bug in the Accordion control sometime ago and was absolutely unable to do so.
I finally gave up and posted it on the toolkit website. It was fixed by them in the next release.
double value = IsStacked100 ? (ValueHelper.ToDouble(dataPoint.ActualDependentValue) * (100 / sum)) : ValueHelper.ToDouble(dataPoint.ActualDependentValue);
What is the exact error in the line posted on the SL forum as above?
|
|
|
|
|
It's a null reference exception. The DataPoint is null. I don't know why.
I have to admit that I've kind of given up on that particular approach (I feel so.... French), and am about to embark on an alternative, but I still have questions about why stuff that I think *should* work but doesn't appear to.
I wanted to create a new type of line series that
a) Accepts just one data value for the Y axis
b) Extends the line from the left axis line all the way to the opposite edge of the chart
In the Toolkit solution, I started out by copying the LineSeries.CS and LineSeries.XAML files to LineTrendSeries.CS and LineTrendSeries.XAML respectively, and renamed all of the internal LineSeries references to LineTrendSeries . With these minor changes, you would think that instantiating the series on a chart would result in a standard LineSeries appearance (because I haven't actually changed anything in the class with respect to what it displays), but nothing except the associated legend item shows up on the chart area. I have no idea why, and requests for help in the "official Silverlight forum" go unanswered for days at a time.
EDIT ========================
The LineTrendSeries object has a Points collection in it that is null. For some reason, the UpdateShapeFromPoints method isn't being called. By all rights, it SHOULD be called because at this point, the object is IDENTICAL to a LineSeries object in terms of content. It's almost like the chart doesn't recognize that the series exists in its series collection.
EDIT ========================
I found that if I put a regular LineSeries object on the same chart AFTER the LineTrendSeries object, the LineSeries.UpdateShapeFromPoints method is called *twice*.
EDIT ========================
On the off chance it had something to do with the LineDataPoint object, I created a version of that class for my trend line series, and it didn't change anything.
.45 ACP - because shooting twice is just silly----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Wednesday, June 23, 2010 10:50 AM
|
|
|
|
|
John Simmons / outlaw programmer wrote: I have to admit that I've kind of given up on that particular approach (I feel so.... French), and am about to embark on an alternative, but I still have questions about why stuff that I think *should* work but doesn't appear to.
Looks hard to track down!
In case you require a stacked bar chart there are a few others available on the internet (these were coded prior to SL4).
Would they fit into your requirements?
|
|
|
|
|
Yeah, this whole thing has been a pain the ass.
I posted the code (SL4Test.zip) in my Uploads section.
The zip file includes the test project I'm playing with, as well as the files I changed in the (November 2009 version of the) Silverlight toolkit code. I didn't include binaries because were just flat out too many and mad the zip too big to upload here.
If you want to look at it, you're going to have to download that version (35261)[^] of the toolkit, copy my files to the source folders, and rebuild it. Currently the references to the toolkit DLLs in the SL4Test project are pointing to a folder in the SL4Test folder hierarchy, but that's easy to change to reference the toolkit Binaries folder instead.
From what Chris said, other users can get to my Uploads section, but if you have a problem, let me know.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Wednesday, June 23, 2010 5:49 PM
|
|
|
|
|
John Simmons / outlaw programmer wrote: , other users can get to my Uploads section, but if you have a problem, let me know.
Just to let you know, I cannot - I don't think I even have an uploads section of my own - must be a rights / rep issue.
|
|
|
|
|
Okay, I'll have to think of something else...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I posted a similar question in the MSDN Silverlight forum, and someone responded that they did "the same thing I did", and it worked fine for them.
I hate it when that happens.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I hate it when that happens.
I hate when say that but cannot actually share their code.
|
|
|
|
|
He tried to share the code, but I can't download it from work (network restrictions), so I have to wait until I get home to see what he did different from me.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I fingered out my problem, and will be posting an article about it this weekend.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: fingered out my problem, and will be posting an article about it this weekend.
That is cool.
|
|
|
|
|
Hi, I'm beeginer in WPF...I have a big problem for me
I don't know how to label be biger when text box get focus?
Want to resolve this problem with trigger...
Anybody?
modified on Tuesday, June 22, 2010 10:44 AM
|
|
|
|
|
Use GotFocus event and change the Font in your event handler.
|
|
|
|
|
Ok, thank you... I want to resolve this with trigger, but can so
|
|
|
|
|
You can solve this using Trigger only if the Label and TextBox are part of a ControlTemplate or DataTemplate.
Try Binding the Element's IsFocused property with Converter. The converter should check for the True/False and return the FontStyle.
|
|
|
|