|
No. In order to access the client-side file system, the app has to be run "out-of-browser", and even then, you're restricted to saving/retrieving files in a special folder.
EDIT ================
Why was this 1-voted? It's the correct answer.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "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
modified on Friday, July 8, 2011 11:56 AM
|
|
|
|
|
No
If you rephrase that as can I make some settings on my local machine that will allow a browser based application to do anyhting to my hard drive and therefore take over my machine. You can make a file open/save operation only and only if it is initiated by the user. Oh and it must be the first operation after the event is raised!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a user control which is created in Silverlight. Can I include the same user control in WPF?
Please reply.
|
|
|
|
|
You can, but only inside a web browser instance running inside the WPF application.
|
|
|
|
|
"but only inside a web browser instance running inside the WPF application" means?
|
|
|
|
|
Sorry, I was trying to be as precise there as possible to remove any ambiguity. It basically means that you need to host a web browser control inside your WPF application, and the Silverlight control will have to be displayed in there.
|
|
|
|
|
Thank you for your reply.
Are you saying that we need to host a webbrowser control inside our WPF application and programatically load the Silverlight control at runtime?
|
|
|
|
|
Yes you need to host a webbrowser control in your WPF application. No, you don't programatically load the Silverlight control - it's a web control, so you should have a web page that hosts the control already. The web browser navigates to this web page and displays it.
The alternative is to create a WPF version of the control.
|
|
|
|
|
Thank you so much for your reply.
|
|
|
|
|
|
I suggest you use Awesomium[^] instead of Including a web browser in WindowsFormsHost
Regards.
Mehdi Ghiasi
|
|
|
|
|
Why would I want to use Awesomium. I'm not the poster, and he doesn't get notified of replies to other people. By the way, Awesomium might not be free depending on his compliance with the license, so the OP might not want to have to splash out on it.
|
|
|
|
|
Actually, why bother[^] try to understand Visual/Logical tree...?
I've been coding WPF for two years now still feel hazy...
I know DependencyProperty propagates down the logical tree and can do TwoWay DataBinding which CLR property cannot do and similar can be said of RoutedEvent. I know Resource resolution goes up/down Logical tree as supposed to visual.
But I don't see any "Application" as WPF developer (as supposed to WPF Framework developer working in Redmond) to understand how it works...
Anyone, please enlighten me... not sure why I need to know [^]unless I'm writing a parser to parse XAML
dev
|
|
|
|
|
There's no reason you have to know how this stuff works, it's just that sometimes it's fun to peal back the covers to have a look underneath. I have found that knowing this has helped me understand where I've had to search for a particular thing in attached behaviors associated with DataTemplate items, but that's pretty esoteric stuff so for the most part it's not necessary.
|
|
|
|
|
During the first month I experimented with WPF, I, for some reason, employed VisualTreeHelper to set values on parent child controls ...
... but really could have been done:
SomeControl.Parent.IsEnabled = true;
or
SomeControl.Children[0].IsEnabled = false;
but for some reason (probably impending deadline > impaired mind), I chosed to used VisualTreeHelper, which seems silly on hindsight.
However, I remember many years ago I got interview question "Why reflection?" - then I was newbie and I said "We never needed it". Now I use reflection in many user controls (more dynamic and declarative)
This is why - when I asked the original question "Why bother visual/logical tree". I really meant to ask "Have I missed something" or "What have I missed". I really want to know if I am correct - "Because I don't work for Microsoft (i.e. Not needing to write a Xaml Parser), there's no real benefits to understand logical/visual tree".
I don't mean to challenge anyone or pretend to be smart arse.
dev
modified on Thursday, July 7, 2011 6:11 AM
|
|
|
|
|
Sorry mate - I didn't see this reply. Anyway, as to the question why bother? There's no real reason that you need to know how to use the logical/visual trees on a day to day basis. The only time I've had to use this knowledge is when I've worked with pushpins inside data templates in Bing maps and I've had to work with map layers from inside it. As the visual tree has to be combined with the visual tree to traverse it, this knowledge was important - but in 4 years, that's the only time.
|
|
|
|
|
Not just Redmond. Certain developers of control libraries may be very interested and NEED to know.
For us end-user app developers, it rarely (if ever) comes into play.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm trying to create a list of expanders. So far I have this, but its not quite right. Can someone point me in the right direction?
<Grid>
<ListBox>
<ListBox.Template>
<ControlTemplate>
<Expander Header="Stuff"
IsExpanded="True">
<StackPanel Margin="25,0,0,5">
<RadioButton>Option 1</RadioButton>
<RadioButton>Option 2</RadioButton>
<RadioButton>Option 3</RadioButton>
</StackPanel>
</Expander>
</ControlTemplate>
</ListBox.Template>
<ListBoxItem>One</ListBoxItem>
<ListBoxItem>Two</ListBoxItem>
<ListBoxItem>Three</ListBoxItem>
</ListBox>
</Grid>
Everything makes sense in someone's mind
|
|
|
|
|
I think you want to go with an ItemsControl instead of a ListBox, unless you want the expanders to be selectable (As in, the user could click to highlight the entire expander).
If you go that route, you need to set:
* ItemsPanelTemplate - Set it to a vertical StackPanel with IsItemsHost="true"
* ItemTemplate - Set this to a DataTemplate containing the expander. The binding will point to the item (In your example, "One", "Two", "Three"), so you can bind the header to just {Binding}. Remember that ControlTemplate sets the appearance for the entire control, overriding any innate behavior, while ItemTemplate sets the appearance of each item within the control.
* For its contents, instead of using ListBoxItems, use regular sys:strings (clr-namespace:System;assembly=mscorlib), or just bind the ItemsControls' ItemsSource to a collection.
|
|
|
|
|
I agree with Ian's reply.
Additionally, you can wrap the ItemsControl in a ScrollViewer if you need scrolling.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I made a DataGridTemplateColumn with a custom-made ComboBox inside. Here's the code:
<DataGridTemplateColumn x:Name="colfkey_tblGarne" Header="Garn" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Garn.Garnbezeichnung}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<local:ucComboBox
ItemsSource="{Binding Path=DataContext.AktuellerDatensatz.Lieferant.Garne, RelativeSource={RelativeSource FindAncestor, AncestorType=local:ucDataGrid, AncestorLevel=1}}"
SelectedValuePath="ID" SelectedValue="{Binding Path=fkey_tblGarne}"
DisplayMemberPath="Garnbezeichnung">
<DataGridTextColumn Header="Garn" Binding="{Binding Garnbezeichnung}"/>
<DataGridTextColumn Header="Garnnummer" Binding="{Binding GarnnummerText}" />
<DataGridTextColumn Header="Zusammensetzung" Binding="{Binding Garnzusammensetzung}" />
</local:ucComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
It displays the data correctly first, but When I alter one value in one row, all other rows get updated too
So I think, there is some problem with the ComboBox's Selected Value binding.
Here's the weird effect:
1.) when I start the application, everything is fine:
http://666kb.com/i/buz3b6b4ozvudmenf.jpg[^]
2.) when I alter the value via ComboBox in one row, mostly all other rows get updated too I'm writing "mostly", because this is really weird, and I can't see a pattern, it randomly updates the other rows too.
http://666kb.com/i/buz3e19wn5ba12w8b.jpg[^]
What am I doing wrong here?
PS: I tried with a standard ComboBox too, same problem.
Kind regards,
Nico
modified on Wednesday, July 6, 2011 11:27 AM
|
|
|
|
|
Hello,
I have designed a number of XxxVisual clases which all (indirectly) derive from UIElement. They are implemented in this way:
public class MusicVisual : UIElement { int x, int y,.... }
public class MyVisual : MusicVisual
{
protected override void OnRender(DrawingContext drawingContext)
{
render, render, render at (x,y)...
}
}
Now I would like to handle mouse events on these visuals, like MouseMove or MouseDown. These visuals have their logical and visual hierarchy (staff stack -> staff -> note), so I can use AddVisualChild method where needed. What are next steps?
I tried to override HitTestCore , but it was never called. According to MSDN[^], it will be called when a hit test falls within the bounding rectangle of the visual object. But I couldn't find out how to tell rendering engine what bounding boxes of my visuals are. I can determine position and size of every visual.
Or maybe I'm looking in a wrong direction. Any help will be appreciated.
Greetings - Jacek
|
|
|
|
|
I may be wrong, but I don't think there's an implementation of any "bounds"-related items until the next UIElement-derived class - FrameworkElement.
Layout System[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: I may be wrong, but I don't think there's an implementation of any "bounds"-related items until the next UIElement-derived class - FrameworkElement.
According to the article you have linked to, it is not true:
The layout system completes two passes for each member of the Children collection, a measure pass and an arrange pass. Each child Panel provides its own MeasureOverride and ArrangeOverride methods to achieve its own specific layout behavior.
During the measure pass, each member of the Children collection is evaluated. The process begins with a call to the Measure method. This method is called within the implementation of the parent Panel element, and does not have to be called explicitly for layout to occur.
First, native size properties of the UIElement are evaluated, such as Clip and Visibility. This generates a value named constraintSize that is passed to MeasureCore.
where Children is UIElementCollection . It is logical for me, since the UIElement has OnMouse-events methods, not FrameworkElement. There must be a way.
Maybe I just have to set the Clip property and not override proper method.
Greetings - Jacek
modified on Wednesday, July 6, 2011 10:02 AM
|
|
|
|
|
Good news: this article[^] helped me a lot. There is some coding to do but it looks promising. Also, my Visuals can now derive from Visual instead of UIElement, which is definitely better.
Greetings - Jacek
|
|
|
|