|
I'm looking for a way to programmatically clear all text boxes and combo boxes on my WPF window at the same time. Is there a method for handling this?
|
|
|
|
|
I don't know of anything inherent. How about looping for all controls and if it is a textbox\combobox then reset its value? (might have to do it recursively if the controls are contained within an hierarchy.
modified on Saturday, April 4, 2009 7:00 AM
|
|
|
|
|
So far, I've been able to find a workaround for any missing functionality in Silverlight, until now. Anyone have any idea how I can get all of the values of an enumeration? And please don't suggest that I iterate from 0 to X and use the IsDefined method - that's simply not a practical solution.
Thanks in advance!
Terry
|
|
|
|
|
|
Ah, of course. Thank you so much.
|
|
|
|
|
Hi friends
I am extreme bigner of silverlight so,
plz help me how run silverlight program
and what i need to install software
Thanks and Regards
Azad Yadav
|
|
|
|
|
You will need .NET Framework (2.0 and on) to install MEB.
|
|
|
|
|
Are you talking develop or run? If it's develop (and assuming Silverlight 2), you'll need Visual Studio 2008, .NET 3.5 and the Silverlight SDK. If it's run, you just need to install the Silverlight control in your browser.
"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
|
|
|
|
|
|
Hehe, Silverlight is a buzzword... first you have to understand what is Silverlight, a quick and dirty definitions (please Ms guys don't read this)... it's like flash but with .net, that is a plugin for IE / FireFox...
You can download Silverlight plugin from the silverlight official site.
To Develop, you will need Visual Studio 2008 + .net fx 3.5 SP1 + SL tools for VS 2008 (you can just go to the silverlight.net getStarted option).
/// -------------------------
Braulio Díez
DBSchemaEditor.com
Free Silverlight based DB Schema Modeling Tool
/// -------------------------
|
|
|
|
|
Hi Azad, u need to have .Net framework 3.5 and u'l need to install silverlight tools from the official microsoft website which are free.
u'l also need to install silverlight plugin again from microsoft's site....
Use the following link.........
http://silverlight.net
Alok
|
|
|
|
|
WPF Noob question:
Can WPF applications can have their appearance change at runtime? I understand, through styles, that one can change the appearance of controls and UI elements, but I was envisoning something more along the lines of having two applications: one "editor" application and a "game" application, both running essentially the same code but having a totally different UI layout (the latter having fewer buttons, simpler controls, menu items, etc). The layout of the "game" UI could be designed by an artist, generally someone who doesn't have access to the underlying code.
How do I go about doing something like that? I'd just need a starting point.
Thanks!
|
|
|
|
|
The first thing I'd suggest here would be that this is a perfect candidate for applying an MVVM pattern to an application. The second thing I'd suggest is that you might want to look into Prism[^] the Composite WPF/Silverlight P and P from Microsoft.
"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'll check that out, Thanks!
|
|
|
|
|
You're welcome.
"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 want to print a simple visual to a printer (some lines and some text, rendered as an image that is then printed).
On my local printer this works perfectly, sharp lines and text. But on another printer, a label printer, the output looks fuzzy, the lines are ragged but only on one side.
A printed test page (via the printer settings dialog from Windows) looks fine, so the printer is capable of printing high resolution. I tried to set some job properties, print quality and so on but no effect.
Has anyone an idea here? Thank you!
|
|
|
|
|
I have a DataTemplate like this: (more actually...)
<DataTemplate x:Key="ProductListTemplate">
<Expander Name="ProductExpander" Header="{Binding Path=ProductName}">
<TextBlock Text="{Binding Path=ProductId}"></TextBlock>
<Image></Image>
</Expander>
</Border>
</DataTemplate> ... a ListBox like this:
<ListBox Name="productListbox"
ItemTemplate="{StaticResource ProductListTemplate}"
</ListBox>
Now the tricky part, if it ever can be solved?
How can I use an XmlDataProvider to populate Image source?
The Listbox contains a lot more products than necessary amount of pictures. Same picture for several products. The xml file:
<PicDb>
<Product Name="W705">
<Image>graphics/W705.png</Image>
</Product>
<Product Name="W715">
<Image>graphics/W705.png</Image>
</Product>
...
</PicDb The Expander header binding and textbox binding works fine, binds to a data class.
Can't figure out how to do it Anyone? Do you get the idea? Let's say that the expanders header result in a string "W705", then I want to use the xml file as a lookuptable and load the expanders image with "graphics/W705.png". But it doesn't seem to work with a mix of binding like that?
|
|
|
|
|
This might offer some ideas:
ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/wpf_conceptual/html/7dcd018f-16aa-4870-8e47-c1b4ea31e574.htm
If PicDb is a separate data struture, maybe binding to a method and passing the name could work. In that case:
ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/wpf_conceptual/html/5f55e71e-2182-42a0-88d1-700cc1427a7a.htm
|
|
|
|
|
If you don't want to go the whole MVVM route, a simple fix is to use a ValueConverter here. Consider the following sample converter code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media.Imaging;
namespace SampleWpfApplication
{
public class SimpleImageConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Uri uri = new Uri(value.ToString(), UriKind.Absolute);
BitmapImage img = new BitmapImage(uri);
return img;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
} To use the converter, you add a reference to it in your Resources
section:<local:SimpleImageConverter x:Key="MyConverter" /> Finally, you bind to it using:<Image Source="{Binding ImageItem, Converter={StaticResource MyConverter}}" /> It's that simple.
"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
|
|
|
|
|
If you see Pete's post, you could just read your XML file in the converter and get the image name for the passed in header string. This will avoid you having to bother about multiple datasources in XAML.
If you still want to use XMLDataProvider, you could use a MultiValueConverter. Passing in the XMLDataProvider and the Header string to the converter.
|
|
|
|
|
Helped me a lot!! Thanks!
|
|
|
|
|
If I insert the following bit of XAML:
<TextBlock Background="AliceBlue" DataContext="{Binding FOO}"<br />
Text="{Binding StringFormat='Selected: {0:N0}', Path=BAR}"/ >
there is nothing in my project called FOO and certainly nothing called BAR - yet there is no error - nothing in output - the whole thing is just ignored.
Why does WPF ignore stuff?
|
|
|
|
|
I'm surprised that you haven't seen something in your Output window. What you might want to do, is use the diagnostics attached property:
<TextBlock Background="AliceBlue" DataContext="{Binding FOO, diag:PresentationTraceSources.TraceLevel=High}"
Text="{Binding StringFormat='Selected: {0:N0}',
Path=BAR, diag:PresentationTraceSources.TraceLevel=High}"/ > To add this in, you need to map to the diagnostics namespace:
xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase" This feature was introduced in .NET 3.5.
"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, it appears I was missing
DataContext="{Binding RelativeSource={RelativeSource self}}
at the top of the tree but why that should mean WPF just ignores stuff is beyond me. Still, it only wasted a few hours - it's a good job there is no swear jar here.
|
|
|
|
|
It's ignored by design. If the binding path doesn't exist then
it is quietly ignored. If the result is nothing to render, then
you're not going to see anything
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|