|
Normally, to set style using C#, I write,
<br />
btn.Style = (Style)FindResource(_styleName);<br />
But what to do, if style is defined inside main 'ResourceDictionary', and button is inside some 'UserControl'. Also, we have to write script inside 'UserControl' only.
|
|
|
|
|
Hi all..
I ran into an issue while implementing BITS, the problem is while creating a job in BITS we have to send the local path (physical path like c:/doc/sample.txt) but Silverlight will not give us the physical path or fullpath. It says access denied.
How to get the physical path or fullpath of the file in silverlight?
Thanks
Nitin C.N
|
|
|
|
|
Silverlight doesn't allow access to client-side files. If you're talking about a server side file, look at the HtmlPage.Document object - you might be able to get it from that.
What is "BITS"?
.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
|
|
|
|
|
|
|
In addition to John's answer, if you are using WCF to communicate to BITS (Im not sure what that is), you can get the path via WCF.
|
|
|
|
|
Hi Nitin,
I think, I already answered your query through Twitter & my Blog.
You can't get the physical path in Silverlight (assume you want the client side path).
If you want server side path, it is easy to do in your server side code & return thru service call.
But, as it is Silverlight, I assume, you want the path of client PC. No, you can't. There are some security reason while the application is running inside the browser sandbox.
If you install it as fully trusted out-of-browser application, you can get it.
Read the Article for some reference: File Explorer using Silverlight 4 COM Interoperability[^]. It may help you.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
Hi everyone,
I've got a Listbox which its itemsSource is binded with a large amount of data.
The binding is very slow so I would like to show a waiting message while the listbox is binding the data.
I need to know when the databinding has finished, does anybody know how do I do it?
Thanks in advance, and forgive me for my broken english!
|
|
|
|
|
I wouldn't bind to a large amount of information in one go if I were you. Using virtualisation you bind to only the data you need at that time, which should make your UI much more responsive.
"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 HAVE TO do it.
If it was for me I would have paged the results, but I have to load all the data from a datasource.
Thatz why I need to show a 'waiting message' while binding the data.
|
|
|
|
|
I have no problem adding an image via code if I am adding the image to the canvas of a WPF window. However I am so far unable to get the image to show if I am adding the image to a custom control that contain a canvas inside.
My setup is like this:
1) WPF Window contains a canvas: WindowCanvas
2) On the WindowCanvas, I am adding several CustomControls
3) Inside a CustomControl, I am in the XML file specifying a canvas that I give a name "ControlCanvas"
4) In the code of my application I am able to add TextBox & Ellipse etc. to an instance of the CustomControl's ControlCanvas. However, adding a Image via code to a CustomControl's ControlCanvas does not work - nothing is shown.
Image myImage;
BitmapImage myBitmap = new BitmapImage();
myBitmap.BeginInit();
myBitmap.UriSource = new Uri("Resources/Test.JPG", UriKind.Relative);
myBitmap.EndInit();
myImage = new Image();
myImage.Source = myBitmap;
myImage.Stretch = Stretch.Uniform;
myImage.Margin = new Thickness(0);
myImage.Width = 400;
myImage.Height = 266;
myImage.Visibility = Visibility.Visible;
Ellipse myEllipse = new Ellipse();
myEllipse.Width = 10;
myEllipse.Height = 20;
myEllipse.Fill = new SolidColorBrush(Colors.Red);
Custom_userControl myUserControl = new Custom_userControl();
main.TopWindow.VirtualDesktopTopCanvas.Children.Add(myUserControl);
myUserControl.myCanvas.Children.Add(myEllipse); ;
myUserControl.myCanvas.Children.Add(myImage);
|
|
|
|
|
Hi,
I created ListView with 2 column -
and i want to add item with with 2 text ( each text will be in different column )
How can i do it on the xaml ?
Thanks.
P.S: Each time i try to add by writing
<listviewitem background="#FF00D3FF" content="TextCulumn1, TextCulumn2">
I get the same text on the both column. . . .
|
|
|
|
|
Post your code. May be that would help us to understand you problem.
In a high level, it seems you are binding same property to both columns.
|
|
|
|
|
The Xaml code
<br />
<br />
<ListView.View><br />
<GridView><br />
<GridViewColumn Width="160" Header=" Header 1 " /><br />
<GridViewColumn Width="160" Header=" Header 2 " /><br />
</GridView><br />
</ListView.View><br />
<ListViewItem Background="#FF00D3FF" Content="Col1_Text, Col2_Text" ToolTip="......" /><br />
<br />
|
|
|
|
|
Guys,
Someone can please help me with this question
|
|
|
|
|
I've been playing with some data bindings recently and I've noticed sometimes I mess something up. Whatever happens prevents the application from shutting down completely. It hangs on a native call to GetMessageW() after my main window has closed.
I'm looking for any help or ideas on how to figure out where my problem might be without removing all bindings and putting them in one by one. I've also been adding my own dependency properties and am not sure if those could be causing the problem.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
You might want to take a look at this[^].
|
|
|
|
|
Thanks. I think that might help.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
You are welcome. Hope this does help you.
|
|
|
|
|
Hey all,
Can someone tell me if WPF .NET 3.5 apps are compatible on Windows CE 6.0? I tried looking at a lot of places and still haven't found a definitive answer to this. You'd think that both being Microsoft technologies it would be obviously supported but I can't seem to find a set response for the question.
Thanks,
kiranpmody
|
|
|
|
|
No they aren't. The CE framework lacks a lot (such as DirectX support) that WPF is built upon.
"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 prompt reply..
|
|
|
|
|
Hi,
I'm a newbie in wpf and I have a problem with the binding.
I have a class inherited from FramworkElement and there is a Collection. The Items of this collection are inherited from DependencyObject.
On the Form is only one TextBox. I want that the text, which is typed by the user will be copied into the first Item of the collection.
Here some code
public class Item: DependencyObject
{
public string Name { get; set; }
public virtual object Value {
get { return GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
#region DependenvyProperty
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(object), typeof(Item));
#endregion
}
public class ItemContainer : FrameworkElement
{
private List<Item> _itemlist = new List<Item>();
public List<Item> ItemList
{
get { return _itemlist; }
}
}
and the form:
Window x:Class="WpfApplication2.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="417" Width="589" xmlns:my="clr-namespace:WpfApplication2">
<Grid>
<my:ItemContainer Height="18" HorizontalAlignment="Left" Margin="-168,0,0,33" x:Name="itemContainer1" VerticalAlignment="Bottom" Width="18">
<my:ItemContainer.ItemList>
<my:Item Name="Item1" Value="{Binding ElementName=txtItem1, Path=Text}" />
<my:Item Name="Item2" />
</my:ItemContainer.ItemList>
</my:ItemContainer>
<Canvas Margin="16,18,8,6" Name="canvas1">
<TextBox Canvas.Left="88" Canvas.Top="15" Height="23" Name="txtitem1" Width="89" />
<Label Canvas.Left="14" Canvas.Top="16" Height="22" Name="label1" Width="58">Item1
</Label>
</Canvas>
</Grid>
</Window>
At runtime the program displays the error2 Cannot find governing FrameworkElement or FrameworkContentElement.
I don't want to inherit item from FrameworkelElement because in the real project the class Item is inherited from another class.
What can I do to transfer the text from the textbox to the first item of the collection ?
Thanks in Advance
Willibert Stofel
|
|
|
|
|
Hi,
I currently would like to compare several test systems running WinXP and Win7 with different graphics hardware (onboard, dedicated, etc.), and therefor need some kind of WPF Benchmark application. I don't have a focus on specific WPF features at the moment, I just want to gain a general impression how each of these systems perform, i.e. how many "frames per second" they produce using different WPF GUIs.
Are there any benchmarking programs available? Which do you recommend?
Thanks alot.
modified on Monday, August 2, 2010 9:19 AM
|
|
|
|
|
Hi, All!
I'm having another major trouble. I have developed a control, that has some properties, but once I set binding to these properties, a strange error occures during the build. Visual Studio highlights an irrelevant string from the xaml code with green color.
here is a code sample which throws that error:
<a:SearchControl x:Name="SearchResult" SearchCriteria="{Binding ElementName=SearchCriteria, Path=Criteria}"/>
Note 2 things:
1) Code below builds fine
<a:SearchControl x:Name="SearchResult"/>
2) In an output window of VS, it is stated, that System.Unimplemented exception occurred in PresentationFramework.dll. Usually, such exception means, that requested method is not implemented, which is kinda odd, because this property is indeed implemented.
|
|
|
|