|
ObservableCollection is binded to ItemsControl and PropertyChange fired on CultureChangedEvent though the items in collection remains the same. This doesnot update the DataTemplate/ItemTemplate. I guess WPF ignores because no change made to the item collection. How do i force a refresh on DataTemplate? i had tried BindingExpression.UpdateTarget().
similar problem is addressed at this Link[^] but the recommended approach didn't work.
any idea?
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
Have you tried raising a Reset notification on the collection?
|
|
|
|
|
Calculation of value of DependencyProperty[^]
1.Local value
2.Style triggers
3.Template triggers
4.Style setters
5.Theme style triggers
6.Theme style setters
7.Property value inheritance
8.Default value
Question is, what's difference between "Style trigger" and "Style setters"?
For example, below is "Style trigger"
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Blue"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
OK
</Button>
I presume "Style setters" simply means:
<Window.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="FontSize" Value="30" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Background" Value="#FFCA5132" />
</Style>
</Window.Resources>
From the reference [^]it says:
"Local value technically means any call to DependencyObject.SetValue, but this is typically seen with a simple property assignment in XAML or procedural code"
So by "Local Value", it means a simple assignment such as:
<Button Foreground="Blue" />
Am I right?
http://www.bobpowell.net/dependencyproperty.aspx[^]
dev
modified on Thursday, July 7, 2011 6:02 AM
|
|
|
|
|
A trigger has conditions and setters. When the conditions are met, the setters are applied. A standalone setter always applies.
|
|
|
|
|
I know there could be restriction for Silverlight application to access local file system and resources. Is it possible for a browser based silver light application made full trustable at client local machine by doing some settings in client machine?
|
|
|
|
|
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++
|
|
|
|