|
I want to learn silver light.Can any one tell me the best approach?
|
|
|
|
|
|
In addition to the help that Mark provided, you should also make sure you have the proper tools.
You need Visual Studio 2008 as well as Expression Blend 3. EB3 is almost a must-have to quickly check your formatting, binding, and event handler settings.
|
|
|
|
|
I want to create a "Are you sure Messagbox when closing application (with never show this message again check box) using WPF and C#,
Could someone please help me out.. its very urgent.
here is the code:
WPF Code:
====================
<window x:class="Pfizer.EPRA.SmartClient.Forms.Master"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:y="clr-namespace:Pfizer.EPRA.SmartClient.Controls"
title="ePRA" windowstate="Maximized"
icon="\Images\ePRA-Icon.png"
closing<b="">="Window_Closing" >
<window.resources>
C# Code:
=======================
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
MessageBox.Show("Are you sure pop-up when closing application ");
Here, I need a MessageBox with Yes, No buttons and A checkbox with "never show this message again"
When never show this message again check box is selected by the user, this message shold not be shown again.
}
thank you very much in advance for helping me out
|
|
|
|
|
rajeberer wrote: Here, I need a MessageBox with Yes, No buttons and A checkbox with "never show this message again"
When never show this message again check box is selected by the user, this message shold not be shown again.
You need to start with a Custom Message Box[^], to which you add a checkbox. When the Show() method returns you need to store the value from the checkbox in some permanent place where your application can check in the future. I think one of the config files is probably the appropriate place to save it; there is probably an article here on CP on the subject.
|
|
|
|
|
Hi,
First of all, i had no intention of this being so long, but i needed to be thourough, so here goes.
I have been a Code Project member for so long that i feel guilty for not contributing more to this wonderful site. I recently have begun converting a Windows Form application that I wrote to WPF. I can safely say that I am really comfortable using Windows Forms because I have been programming using them for years. Before that, MFC windows apps. I'm not afraid of a challenge, and I really believe that in the long run my application will be better for making the transition to WPF. Thus, comes the issue.
My Application is a retail photo editing application that is used exclusively in our stores to sell printed photos to people These photos have been adorned with "Borders" or "Frames" that are bitmap based. Basically, I have a set of "Layers" that comprise my product. The picture, the Bitmap border, and maybe some little adorner decals and a text layer or two. Each layer has a z-order and in my WinForms app is neatly rendered by a custom control that i wrote using old style GDI+ drawimage commands and a-lot of refreshes everytime something changed.
When I say everytime something changed i mean if the user dragged the photo to a new position under the border or changed the zoom, colors, saturation etc the application would have to redraw everything reflecting the changes. Needless to say, that in order to achieve realtime rendering of all these effects, i had to use a scaling factor and cached, smaller bitmaps in order to get these things to happen in realtime. It was a real pain to keep everything straight.
Then comes along WPF and turns everything upside down for me. I now have a new rendering system that natively supports transparency and has pixel shaders for the effects such as saturation and chroma key. I have done some tests with raw bitmaps and all of these effects can be achieved realtime with no problems on todays hardware. Everythings good right?
Wrong. I have converted everything but what i call the main Workspace control. I am soooo stuck on this it isn't funny to me anymore. I have been reading everything i can get my hands on and I guess I am too close to the problem because I am hopelessly stuck trying to decide how to implement this. I have a .xml file that describes how a picture should be placed in a border. meaning the top left and size depending on the orientation and aspect ratio. This is already done from my winforms application, so i have all of the info i need. I would love to make a control that would work in my "Real world" coordinates. Just so you know. My bitmaps are 300 dpi bitmaps so they are large. like 2700x3000. I think i should be able to make some sort of composite control that is like a canvas that holds all of my "Layers" and places them at there respective coordinates and shows all of the content even though it is huge, all in a small control, say 600x600.
I can see 2 ways to do this. Do as i said, and layer image controls in some sort of layout control, but i have no idea how to translate the coordinates or does WPF handle that automagically for me? or create a control and use drawvisuals in order to make the composites. I have been trying to get something to work for days and keep running into walls. I know that this comes from a basic lack of experience in the WPF layout technologies, but i need help. I thought this topic would maybe someday make a good 1st article for me. So what do you think? Any help? Ideas? Good idea for an article?
Thank you for your time,
Bryan Wilkins
|
|
|
|
|
I figured that I would post what I did here for others to see how I approached it and to comment on my thoughts.
I took a step back and with a deep breath did some research on custom panel layouts. It seems that I really needed to understand this because i made a custom panel layout somewhat akin to a cross between a Grid and a Canvas. Got it to auto size the composited bitmaps into the size of the panel by figuring out a global scale in the MeasureOverride. That way i still get the benefit of attaching pixel shaders to the image objects if i need to do saturation,chroma key etc...
Please tell me if you think this could help others so i can think about making it an article if useful.
Bryan
|
|
|
|
|
In my Windows Forms application I have a listbox on the form. This is a multiple selection list box.
I can use SelectedIndices property to get the indices of all the selected items.
However, given an index number, is there a simple way to tell if the item is selected or not? Right now I search the SelectedIndices to see if the index is there. I wonder if there is a method call to tell me directly if an item is selected or not. I tried to find that but couldn't.
Thanks!
|
|
|
|
|
*Ahem* This is the forum for WPF/WCF and WF, not WinForms.
"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
|
|
|
|
|
|
Collin Jasnoch wrote: I did some searching and keep getting 2.0
All the 2.0 stuff applies to 3.0. If you know 2, then you
could jump right to What's New in Silverlight 3[^]
There's a bunch of resources here: Silverlight: Get Started[^]
If you already know WPF then most tutorials are probably
going to be too basic. In that case you can always go right
to the documentation: Silverlight[^]
Also, the Silverlight Forums[^] are a great resource and
very active.
Silverlight doesn't have commanding and lacks many of the
data binding features of WPF, but often these can be emulated
in a few lines of code in code-behind, which may apply to the view
but should only break your model if you chose. You do know the XAML
just gets converted to code too, right? So extending, for example, a
UserControl's XAML with some code in the UserControl's class is just
the same as adding XAML.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi guys , in my silver light page i dont see designer tab, its just xaml view not design view i can see
why?
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Tauseef A wrote: why?
Assuming you mean in Visual Studio...
There is currently no designer in VS 2008 -
there never was.
Try the VS 2010 beta or wait for it to be released.
You can also use Expression Blend[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
but it was with prior version of silver light, why not now ?
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
There was a preview but not a designer.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
so without a preview how can create interface , if it is not cumbersome?
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
Use Blend or wait for Visual Studio 2010.
I don't find it cumbersome myself since I'm comfortable with
XAML and code, and at least there's intellisense.
I could see where it would be cumbersome if you're used to
visual designers.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
can u give me a easy example for WPF Gird how to bind data to the grid
|
|
|
|
|
Assuming that the following is your data class:
public class MyData : INotifyPropertyChanged
{
private event PropertyChangedEventHandler _propertyChanged;
private int _id;
private string _name;
public string Name
{
get { return _name; }
set
{
if (_name != value)
{
_name = value;
OnChanged("Name");
}
}
}
public int Id
{
get { return _id; }
set
{
if (_id != value)
{
_id = value;
OnChanged("Id");
}
}
}
public event PropertyChangedEventHandler PropertyChanged
{
add { _propertyChanged += value; }
remove { _propertyChanged -= value; }
}
private void OnChanged(string p)
{
PropertyChangedEventHandler handler = _propertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(p));
}
}
} Add an observable collection to watch this:
private ObservableCollection<MyClass> _data = new ObservableCollection<MyClass>(); Add some data to the observable collection:
_data.Add(new MyClass{Id=1, Name="Josh"}); Assign the collection to the datacontext of your window using
DataContext = _data; There you have the basics of the data. All you need do now, is bind the ItemsSource of the grid to the data source, as in:
ItemsSource="{Binding}"
"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
|
|
|
|
|
Ok, I shall try to explain as thoroughly as possible the problem I'm experiencing.
I have TextBox in a tab on the left of my window (Text1). The rest of the window has another TextBox (Text2). As I type into Text2, if I press F12, I grab the current word and try to put it into Text property on the TextBox Text1. Although the TextChanged event fires and I can see its Text property has been set, visually it isn't set and the code dependant on the new value runs and then 'unruns' if you follow me.
I don't know if this is a focus issue or something, but there are no exceptions in the output window and no more major breakages.
Does anyone have any idea what I might be missing here?
Thanks in advance,
Simon
|
|
|
|
|
This is a WPF project ? Do you have any events on the other textbox that might fire and change or reject the text ?
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.
|
|
|
|
|
Yeah, this is WPF. I know what you mean, but I don't set the Text property anywhere else or set e.Handled to true or false anywhere.
When I set the Text property, TextChanged fires on that TextBox as normal. In that handler, I read the value out to use it for other purposes. All this code does run ok, but visually, it's as if nothing happened!
This is odd. I'm going to try and create a simple WPF app with 2 TextBoxes and do something similar.
If you have any other ideas, I'd love to hear them.
|
|
|
|
|
Are you setting the text property of TextBox1, or are you updating property to which the Text property of TextBox1 is bound?
If you are updating a property the problem is likely that you need to raise an OnPropertyChanged event for that property. You'll have to implement INotifyPropertyChange...
|
|
|
|
|
Hi,
I am using binding a fair bit, but in this particular case, this textbox is not bound to anything. I am merely doing the following:
myTextBox.Text = "some text";
I am getting some bizarre feeling that WPF is preventing the visual change based on some form of focus or caret permission type thing, but I can't be convinced of this.
It's an odd one at the moment.
|
|
|
|
|
Dear all,
I have a maintenance database table(having ColA(primary) and ColB(varchar)) being records inserted using asynchronous web service.Before inserting a new record into table on save button click event,i have to check uniqueness of record.So, When i send query request to check with given record Webservice completed event is raised after the save button click event.So, I am not able to check the uniqueness using asynchronous web services.Please help me in finding a solution for this.
regards,
Sundeep G
|
|
|
|