|
Wrong forum mate.
Your question has nothing to do with Silverlight, right?
|
|
|
|
|
|
yuripon wrote: I create it in SL 3..
You would need to add C# code in your code behind file. This code should generate a button dynamically.
See here.
|
|
|
|
|
thx for your solution..
|
|
|
|
|
You may also try creating a UserControl and then use it for your application. I think, it will be useful and handy in your case.
|
|
|
|
|
i've try it, but it can't. can you give me a sample. I would like create random button or image appear when it's loaded, and it's can change how many button or image appear in current time. Like the first button appear 2 buttons or images when loaded, and we click other button(outside of the buttons which created).. and than the next random button appear with different buttons (may be 3 buttons appear or 10 button).
|
|
|
|
|
Hi all, i'm making a project in AI,i'm buil a game Missionaries and Cannibals with GUI by WPF, but i don't know how to solve mouse event such as mouse_hover,mouse_click..., any body can help me. There are many problem i have to solve, poor myself...
|
|
|
|
|
I suggest you do some research around writing WPF applications, doing it well is pretty different from Winforms.
The other thing is, I'd look at the AI stuff first as it's the most difficult, you can always get to grips with WPF as you go along.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Don't just dive in, some of WPF is very different from previous technologies. I would suggest this excellent range of tutorials (which includes events)
WPF: A Beginner's Guide - Part 1 of n[^]
shane
|
|
|
|
|
Using SL3, VS2008 SP1, and .Net 3.5 SP1...
When I open a XAML file, I get the follwoing exception:
An unhandled exception occurred (System.TypeInitializationException) in PresentationFontCache.EXE [4716].
I googled the message, and there are no hits - at all. If I google the EXE cited in the message, I get a bunch of hits about people either wondering what the file is for, or asking if they have a virus.
Has anyone ever seen this, and even better, does anyone know how to fix it?
.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
|
|
|
|
|
Well - for starters, this file is in the GAC, so is not a virus.
Not unless a virus got to it and destroyed it somehow.
WPF applications depend upon PresentationCore, PresentationFramework and WindowBase assemblies that need to be loaded and the start-up of the PresentationFontCache service. However, what this has to do with Silverlight is what I have no clue about.
Try to reset your devenv settings by using devenv /resetskippkgs in the VS command prompt.
Reinstalling SL3 may then be the only option (unfortunately).
|
|
|
|
|
I *know* it's not a virus. I was just mentioning what I found on google.
After I posted the original message, I found out both of the other guys on our team are getting the same error. I installed this stuff on my own personal machines (all running Windows 7 64bit), and it doesn't happen. I've only seen it on the machines at work (all running Vista 64bit). The only difference (that I can see) is the OS.
.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: Vista 64bit
Hmm....very intesting.
I've never come across this error on Vista 32 or XP.
Maybe something for MS to look into?
|
|
|
|
|
Yeah, I posted this on Tthe silverlight forums...
.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 am developing a video asset manager for clips and full movies using Silverlight 3. It plays many different flavors of clips and everything works fine on the PC.
This problem is strictly a problem when on a Mac using Leopard and/or Snow Leopard with current updates. It has been a problem on several types of Mac machines, from a beast of a Mac Pro, to a standard Mac Mini, to a MacBook Pro that is relatively new. I tested with Safari 4 and Firefox 3. Both had the issue.
We have an issue using progressive download for full movies, yet shorter clips of 10 minutes or less are fine. This is only with a Mac; there are no problems at all on the PC. The details on the file we are currently using to test with are at the end of this entry.
The problem is: when the movie is played, it plays fine. It starts downloading, but once it hits a certain point (roughly 80% to 98.8%) the downloading stops and the player will no longer play or do anything. The silverlight app is not frozen on a fast machine though and I can navigate to other screens within the app and go back to the player, but the same problem still exists. We were streaming it from a server in that was not local, then tried streaming on a local network machine (which was much faster to test) but still had the problem.
I did notice that the % that is loaded before the player freezes is pretty constant for each instance of browser used; i.e. if I open Firefox, it will download to 80% 9 out of 10 times. Then if I close Firefox and re-open it will download to 89% 9 out of 10 times.
Tested on a Mac Pro with 8 cores at 3GHz, 12 GB RAM and OS X (10.5.8), the silverlight app does not freeze. Tested on a Mac Mini with 1.83 GHz Duo, 1 GB RAM and OS X (10.5.8) the silverlight app crashed in safari, but not in firefox, though firefox performance was very bad when the problem occurred.
I have searched all over the net for some data on this problem without any luck.
I tried disabling the download status update, but the video still froze.
Has anyone encountered this or have any guidance?
Regards,
Justin
--
File info:
General
Format : MPEG-4
Format profile : Apple TV
Codec ID : M4VH
File size : 1.24 GiB
Duration : 1h 54mn
Overall bit rate : 1 556 Kbps
Encoded date : UTC 2010-03-16 04:44:42
Tagged date : UTC 2010-03-16 04:45:58
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L3.0
Format settings, CABAC : No
Format settings, ReFrames : 2 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1h 54mn
Bit rate mode : Variable
Bit rate : 1 430 Kbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 23.976 fps
Resolution : 8 bits
Colorimetry : 4:2
Scan type : Progressive
Bits/(Pixel*Frame) : 0.194
Stream size : 1.14 GiB (92%)
Language : English
Encoded date : UTC 2010-03-16 04:44:36
Tagged date : UTC 2010-03-16 04:45:58
Color primaries : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format version : Version 4
Format profile : LC
Format settings, SBR : No
Codec ID : 40
Duration : 1h 54mn
Bit rate mode : Constant
Bit rate : 121 Kbps
Nominal bit rate : 128 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Stream size : 99.4 MiB (8%)
Language : English
Encoded date : UTC 2010-03-16 04:44:37
Tagged date : UTC 2010-03-16 04:45:58
|
|
|
|
|
VS2008, SL3...
I have a UserControl that dyanically adds buttons in a grid. I want to display another UserControl when the user clicks one of those buttons, essentially replacing the UserControl on which the user clicked the button.
In a nutshell...
User naviagtes to my SL app
UserControl A is displayed
User clicks a button in A
UserControl B is displayed
--------
How do I do this?
.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
|
|
|
|
|
You need to look at this[^].
Another approach actually could be to use Microsoft Prism - this allows you to remove and add regions into a placeholder (but this would mean re-designing your application to adapt to Prism).
|
|
|
|
|
You can create multiple templates for the data grid (or any controls), and switch them at runtime. If you use Prism, you can specify a region in the data grid, and use the region manager to register a view (or multiple views).
|
|
|
|
|
Hi there!
In our application (we use MVVM pattern) we have a treeview that uses a ViewModel as DataContext. Each node then has its own ViewModel. Depending on the type there are different HierarchicalDataTemplates. In other words we have a ViewModel hierarchy. This works without any problems.
Now I implemented a context menu that should enable the user to open a modal dialog that shows some properties of the ViewModel (actually of the underlying business object). As it is not easy to open a modal dialog with MVVM pattern, I used the WPF Quick Recipes - Dialogs[^].
To abbreviate things, I need to place the following code snippet within my TreeViewItem. This is responsible to show the modal dialog when setting the ModalDialogViewModel property. I need to put this into the treeviewitem in order to get the correct DataContext from the ViewModel of the item.
<FrameworkElement DataContext="{Binding Path=ModalDialogViewModel}">
<behaviour:DialogBehavior.DisplayModal>True</behaviour:DialogBehavior.DisplayModal>
</FrameworkElement>
Where and how can I place this in my TreeViewItem. ControlTemplate? DataTemplate?
Hopefully you understand what I mean. Otherwise tell me, what's not clear!
Thanks in advance!
Florian
modified on Tuesday, April 13, 2010 9:53 AM
|
|
|
|
|
OK, I try to give more information. Maybe the last post was misleading. I have the following attached property (shortened):
public class DialogBehavior
{
public static DependencyProperty DisplayModalProperty = DependencyProperty.RegisterAttached("DisplayModalProperty",
typeof(Boolean),
typeof(DialogBehavior),
new UIPropertyMetadata(false, AttachToDataContextChanged));
public static void SetDisplayModal(DependencyObject target, Boolean value)
{
target.SetValue(DialogBehavior.DisplayModalProperty, value);
}
public static Boolean GetDisplayModal(DependencyObject target)
{
return (Boolean)target.GetValue(DisplayModalProperty);
}
private static void AttachToDataContextChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
{
FrameworkElement element = target as FrameworkElement;
element.DataContextChanged += (a, b) =>
{
var dialog = new Dialog();
dialog.DataContext = b.NewValue;
dialog.Owner = Application.Current.MainWindow;
if (GetDisplayModal(target))
{
dialog.ShowDialog();
}
else
{
dialog.Show();
}
};
}
}
}
When this is attached a handler for the DataContextChanged -event is registered. The handler opens a dialog when the DataContext changed.
Now I need to nest a FrameworkElement which is holding the DataContext into a TreeViewItem . What I did up to now is the following:
<HierarchicalDataTemplate DataType="{x:Type ViewModels:TreeNodeViewModel}"
ItemsSource="{Binding Children}">
<StackPanel>
<FrameworkElement DataContext="{Binding Path=ModalDialogViewModel}">
<behaviour:DialogBehavior.DisplayModal>True</behaviour:DialogBehavior.DisplayModal>
</FrameworkElement>
<TextBlock Text="{Binding DisplayName}" />
</StackPanel>
</HierarchicalDataTemplate>
But, as soon as new TreeViewItem s are added, I get a first chance exception of type 'System.NullReferenceException' occurred in PresentationFramework.dll. The problem must be in my DialogBehavior. Because as soon as I take this out, the code works.
So what is my mistake?
I appreciate any ideas!
Florian
|
|
|
|
|
OK, finally I found the mistake:
The first parameter in the constructor of the DisplayModalProperty needs to be "DisplayModal" instead of "DisplayModalProperty".
public static DependencyProperty DisplayModalProperty = DependencyProperty.RegisterAttached("DisplayModal",
typeof(Boolean),
typeof(DialogBehavior),
new UIPropertyMetadata(false, AttachToDataContextChanged));
No, answer! Anyway, thanks to everyone who thought about it!
Florian
|
|
|
|
|
i want to open my control in new browser window
currently i m using radwindow control but its not opening new browser window.
below is sample code of mine
frmEntityMaster = new EntityMaster();
window.Content = frmEntityMaster;
window.show();
please please let me know is it possible to open this in new window browser.
because in silverlight we have only one aspx page where we used to load
usercontrol that's why HtmlPage.Window.Navigate option is eliminated in mine case because i need not open another uri i have navigate in my applictation but with new browser window
Reasons are not Important but Results are Important.
Swati Tripathi
|
|
|
|
|
Did you check the rad controls website?
You might find some documentation available there.
|
|
|
|
|
yes i did checked with rad controls website but i did not find anything
Reasons are not Important but Results are Important.
Swati Tripathi
|
|
|
|
|
Hi guys, after some advice.
We're currently using Prism to architect an MVVM soulution to one of our business requirements. The requirement is essentially to allow detail record editing in a form. The form itself will contain several drop down lists to limit what the user can choose. My question is how / at which point should we be getting the items to fill these drop downs. As it stands, when we return the "record" to be edited (see next question also), we're also returning all of the lookup lists and binding at that point - is this the "de-rigeur" way of doing it, or should we be making multiple calls - one for the data, one for the lookups?
Secondly, our view model currently contains an entity field, which we're using to bind to controls via a binding Path - something like {Binding Path=Customer.Name}. Now the entity class (Customer) implements INotifyPropertyChanged, and when one of (For example), my text fields change, the entity itself correctly updates and fires PropertyChanged event, but the ViewModel appears not to pick this up. The problem is that I need to intercept the change (or at least know that it's happened) at the ViewModel to requery some CanExecutes for commands. The only way around it I can see is to expose a filed per field on the form as separate properties, and then munge them together into the object when necessary, but this seems like overkill to me - is there another "recommended" way of doing it?
C# has already designed away most of the tedium of C++.
|
|
|
|
|