Ok I feel like I am just missing something small here, but it has taken me too long to figure this one out.
I have a custom UserControl that has a drop shadow. This UserControl is then used as the view to create a ModelUIElement3D. The drop shadow works perfectly when first displaying. The trick here is that I want to be able to change the direction of the shadow programmatically.
I have set up a binding to the ShadowDirection property that I know is working correctly, so I am left to believe that the problem lies in my view not updating. I have tried to invalidate the ModelUIElement3D, the UserControl, and the Window they all sit in, but have had no success.
Anyone know where I might be going wrong?
Thanks in advance.
Rick
Does the object to which ShadowDirection is bound implement INotifyPropertyChanged?
If not, the UI will never pick up changes from the bound object.
Related
I can't change the size of this damn control not even god wanted me to! I've tried https://www.devexpress.com/Support/Center/Question/Details/Q458946, https://www.devexpress.com/Support/Center/Question/Details/B96266 and https://www.devexpress.com/Support/Center/Question/Details/B193170 without success...
My big probem here is that, if I SET "AutoSize", when a panel get hidden by "AutoHide", it WONT be visible again. If I disable "AutoSize" the panel shows up again, but its size will be off...
Any ideas? im really lost here... and I do belive that this is a bug...
I've managed it... the problem was the incapsulation regarding XtraTab regarding the docking of the inner UserControl that contains the other control of the dock, since DockManager needs a ContainerControl the function properly... note that IContainerControl from Control.GetContainerControl() is not enough...
I am very new to Expression Blend but can't find any solution with google. I would like to style a Menu and it's items. But how can I see the actual look of the PART_Popup? The IsOpen Property is bound to something like {Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}. It seems I am only looking at something complete invisible :). There is also a SystemDropShadowChrome but I actually can't see this thing. The eyes next to all the items are active. And even if I change some background colors all that I see is just a black transparent rectangle.
Is this a toolkit control (dropdownmenu) or a telerik (radmenu) or something? If you've already broken out the template (eg; Right click->Edit Template->Edit Current/Copy) Then there's a couple things you want to try to find it since sometimes they can be oddly embedded.
Go to the root level of the control, try Right Click->Edit Additional Templates->...
If that' doesn't provide your part_ look in your broken out template resource you've created and inspect your object tree. You're looking for embedded controls appearing as objects. Right click the embedded control in your object tree and edit its template (Current or Copy)
You'll potentially sometimes have to drill down multiple layers within a template to expose the objects you wish you to edit. If you specify which control you're working with I'm sure we can tell you exactly how to get to where you need more efficiently. Cheers!
Try exploring the States tab. Most likely some of the parts are only visible in certain states.
I've done some digging in trying to solve this, but haven't yet found a solution that works for me.
Basically I have an <ItemsControl> and in the <ItemsControl.ItemsTemplate> I have a <ListView> which displays a number of people's names. There will always be between 0 and 5 people's names listed.
What I want to do is have a tooltip popup with additional information relevant to the entity that is being hovered over. How do I get the index (or the content like the name) of the item I am currently hovering over though, to ensure that what the tooltip is displaying is for the correct person?!
I have a MouseEnter event on the listview which is triggered every time the mouse moves over an entity & in debug mode I can explore down into the sender details & can find the person's name that I want, but how do I get to it from code?
What I want is something like:
int index = sender.GetCurrentlyHoveredOverItem();
I don't want to overcomplicate this post by listing everything I've tried, but if you want any further info, please let me know.
Thanks in advance for your help!
As others have hinted at, but not explicitly said, the items in the ListView should implement the tooltip directly, using an ItemTemplate if needed, rather than at a global level.
<ListViewItem ToolTipService.ToolTip="Tooltip for this item" />
So you have a collection (ItemsControl) of lists (ListView) and you need the tooltip to be specific to a specific element within one of the internal lists, did i understand that correctly?
If so, why not create a ListView.ItemTemplate to take care of that?
If you are using MVVM…
Bind IsMouseOver to a property in the VM, like "CurrentlyHoveredPersonList". Use OneWayToSource.
Create another VM property called "HoveredPersonListViewModel" that contains all the details you need for your tooltip. When CurrentlyHoveredPersonList gets set, populate HoveredPersonListViewModel and raise a property change notification. You'll get an actual reference to the object, so you might not need the index, but if you do you can use IndexOf(object) to get it from the source list right there in the view-model.
Bind the tooltip's DataContext to HoveredPersonListViewModel and its constituent controls to the appropriate properties thereof.
Scenario: I have a (numeric) textbox, a button, and a label. When the button is clicked I'd like the label to "animate" to the numeric value in the textbox (like a spinning dial)
Given:
a) that animations in storyboards cannot have databindings (because they are not FrameworkElements)
b) the lack of triggers in Silverlight
What is the best, and with least coupling of the view model to the view's storyboard, way to update the target animation value and start the animation when the button is clicked?
Note: The scenario is conceptual, so don't concentrate on the specifics of 'animating' numbers or anything
If your goal is strictly to reduce the code-behind in the view I think that an attached behaviour on the Label would work for this. The attached behaviour on the label would expose the number to be animated to and when this number changes an animation (in code) would be run to animate from the old value to the new value.
One drawback is that your animation is now in code, unless you store a templated (just has fake values to start with) version of it in a resource file somewhere where you can load it as needed and replace the templated values.
This article from Josh Smith seems to be the authority on Attached Behaviours;
http://joshsmithonwpf.wordpress.com/2008/08/30/introduction-to-attached-behaviors/
I recently had to solve a similar problem in an MVVM application. My problem was that I needed to animate a container's height from zero to auto. Since Auto is a dynamic value I recognized that the animation (or storyboard) would need to be built (or manipulated) on demand. The solution that I put in place involved using view code-behind to update and fire the animation.
This isn't the most MVVM-friendly approach; however, animations in WPF can be tricky in XAML. Since this solution is really just a workaround for a XAML limitation it seems okay to tie the code directly to the view. Likewise, if the views were mocked then there would be no framework elements to animate, so it really wouldn't make sense to place this code on the VM side.
Does anybody have a better approach?
I have a question regarding a ComboBox in silverlight and it's selected item.
I would like to determine what triggered the SelectionChangedEvent, was it the user selecting a new item in the list or was it programatically set?
While ideally I would like to solve this using the CommandPattern (I am essentially using a modified RelayCommand (http://joshsmithonwpf.wordpress.com/2008/11/17/emulating-icommandsource-in-silverlight-2/). I am open to other suggestions.
I have also played around with the SelectionChangedEventArgs, which has an OriginalSource property, which upon first inspection may appear to help, however it is null (regardless of the manner in which the item was selected.)
Any ideas, other than setting an internal flag? :)
Thanks
Unfortunately this is a tough thing to determine, since the framework works pretty hard to simply bubble up any changes or user events in this situation as that selection changed event.
If you really need to, you could write a simple ComboBoxWrapper that is effectively the flag you're talking about - so you could derive from ComboBox, try overriding or hiding the CLR setter for SelectedItem, and then maintain state that way.
Any particular scenario in use here? There may be another way to approach a solution.