|
Oh how I wish Silverlight 3 supported virtualization on hierarchical items.
"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 Thanks for reply. Yes we tried the Silverlight tree, but results are not encouraging. We are only loading few hundred records and most of them are at first noode. It is still taking un-acceptable amount of time.
Regards
Rajeev
|
|
|
|
|
I have a silverlight application,that communicating and getting data through socket communication.At each Receive callback i want to get data and update in the GUI at the moment itself.In this case sending and receiving data asynchronously,but the delegate for GUI updation in action only after all receive callbacks.How can i execute GUI updations sequentially with each callback?
|
|
|
|
|
You can call another service after completing of first call.
For example:
service.Call1Completed += (sender, e) => {
//Update the UI.
service.Call2Completed += (srd,e1) => {
//Update the UI.
};
service.Call2Async();
};
service.Call1Async();
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
My scenario is like this.
SocketReceiveCallback(object sender, SocketAsyncEventArgs e )
{
// read data from e.Buffer.
if ( dataReceived == TotalDataSize ) // checks of the complete reception of one image
{
// update the GUI using the received data.
System.Diagnostics.Debug.WriteLine( “ received image “ );
Dispatcher.BeginInvoke(new DisplayImageDelgate(DislayImageData), imageData); // imageData is a class containing the received data
}
Else
{
// call socket.receiveAsync() to get next set of data.
}
}
private void DisplayImageData (MyImageData data)
{
if (data.ImageStream != null)
{
BitmapImage bmp = new BitmapImage();
bmp.SetSource(new MemoryStream(data.ImageStream));
myReceivedImageCtrl.Source = bmp; //GUI update should happen at this point.
System.Diagnostics.Debug.WriteLine( “ Draw image “ );
}
}
Please note that my application, there is continues async requests to server ( corresponding to user action ) and server responds with a stream of image data( eg:- 100 images. The application needs to update the GUI immediately after each image is received ( even while the server streams the data). In the above case although the SocketReceiveCallback is getting the data continuously from server, the GUI update happens only after all the data receive is completed( which can take a long time ).
It seems that although the DisplayImage function is invoked using BeginInvoke, the system actually executes the display function at a later stage, causing ‘jumping’ image displays
The debug trace obtained was:-
received image
received image
received image
received image
Draw image
Draw image
Draw image
Instead of the needed
received image
Draw image
received image
Draw image
received image
Draw image
What could be done?
Thanks and Regards
JS
|
|
|
|
|
You can create one List and add the image data on completed event. and call the draw before receiving all data.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Dear all,
I've looked around to find an elegant solution to my problem, but not with a log of success...
I would like to prevent a control (custom label, custom button,...) from being rendered (drawn, painted.. ?) based on a condition (actually, a database linked security check)
but not by using the visibility or opacity properties as I would like to keep these properties freely usable by the users of the control in design mode.
I tried to override OnRender, passing a null drawingContext etc. but it doesn't work.
Does anyone have an idea how to do this ?
Thanks all!
|
|
|
|
|
You could always create an empty style for the control if necessary.
Apply a DataTrigger to apply this style based on your condition.
"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
|
|
|
|
|
Yes I investigated this, but how can I reset the style to the default one after ?
The process is quite like this:
public MyLabel()
{
SecurityHandler.Instance.SecurityChanged += new SecurityChangedEventHandler(Instance_SecurityChanged);
}
void Instance_SecurityChanged(object sender, string newUsername, int newSecurityLevel)
{
this.securityVisibilityCheck(); // Should change the style here so
}
Thanks for your quick reply!
|
|
|
|
|
When the condition triggering your data trigger is removed, the default style is automatically reapplied. That't the beauty of triggers - you don't have to write a lot of code to reset things when the condition is no longer true.
"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
|
|
|
|
|
Indeed
But unfortunately I do not have a simple trigger to decide, and if I have to handle converters, I prefer to make everything in code.
|
|
|
|
|
So simple...
Just set object.Style = null;
Thanks all!
|
|
|
|
|
I'am trying to develop an asp.net website using silverlight but i've tried to install silverlight but it says i need pre requisites please point me to the correct direction
|
|
|
|
|
All that you need to download is linked to from this page[^].
"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
|
|
|
|
|
You need to have .NET 3.5 service pack 1 and Visual Studio 2008 service pack 1 before installing Silverlight Tool for Visual Studio.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Hi,
I am working on a silverlight application. In this I need to place usercontrols on a canvas in the Page.xaml page dynamically at run time. Later I need to set the data values for the datagrid on these user controls from the Page.xaml itself. I want to set different data for different user controls.
How can i differentiate these user controls from one another and set differnt data to their datagrid from Page.xaml itself.
please reply me if u have any idea to solve this.
Thanks in advance
|
|
|
|
|
There are a couple of ways to do this; it just depends on whether or not you are using pure databinding and MVVM. If you are using MVVM and pure databinding, then there's very little that you need to do because the View/ViewModel integration will take care of the hard work for you. If you aren't, then you can assign a name to each control when you assign it using the x:Name property, e.g. x:Name="myUserControl1" (this is if you add it into the XAML). If you add it using code behind, you just assign the name to the Name property.
"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
|
|
|
|
|
Either you are instantiating the objects yourself, and can take them with x:Name and have your own reference, or you are using them in a template in the DataGrid. If you are using them in a template, you can hook into the <coded>Loaded event and do something with them. For example, you might do this:
<DataGrid>...<u:MyControl Loaded="MyControl_Loaded".../>...</DataGrid>
In the MyControl_Loaded you can then take the event arguments and do something with the control, either processing, passing it into a controller, etc.
|
|
|
|
|
I have a pretty basic question to which I want a solution.
I have a bunch of controls on a WPF form. Some controls are within a Grid. I want these controls to stay centered within the grid when maximizing and resizing the window, but as soon as I maximize my window the controls get thrown out of position. I know this probably has someting to do with the Margin property of the controls. Can someone just please tell me how to set the margin or any other property so that the controls stay where I want them too
Thanks in advance
|
|
|
|
|
Etienne_123 wrote: Some controls are within a Grid. I want these controls to stay centered within the grid when maximizing and resizing the window
What is the parent of the grid with the controls? The parent may
be affecting the layout.
Here's an example of a grid with controls that stays centered in a window:
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Content="button1" Grid.Column="0" Grid.Row="0" />
<Button Content="button2" Grid.Column="1" Grid.Row="1" />
</Grid>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The parent control is a Groupbox
|
|
|
|
|
Etienne_123 wrote: The parent control is a Groupbox
Ok....and how is this groupbox supposed to behave when the window
is resized?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Etienne_123 wrote: The parent control is a Groupbox
Then you should give more details, as a groupbox can have only one child.
You can't turn lead into gold, unless you've built yourself a nuclear plant.
|
|
|
|
|
If you don't want your controls to change size or position, you have to anchor them to *just* the left and top sides of the parent control.
Be aware that if you change the control's position in the designer (as opposed to changing it in the XAML), the designer will make assumptions based on some weird-ass algorithm and will CHANGE the anchors for you. You then have to go back and change them back to what you actually wanted. I've heard that they fixed this behavior in VS2010, but I'm not sure because they claimed they fixed other stuff in 2010, and it *that other stuff) sure as hell ain't fixed.
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
"Real" WPF coders use notepad to type XAML!
You can't turn lead into gold, unless you've built yourself a nuclear plant.
|
|
|
|