I have 2 view model in main window
In which i have 1 button in one view model, while in my other view model i have a panel and initially tht panel is visible=fALSE
I want tht while i click on tht button the panel from another view model will be visible
The first one WILL NOT display the value but the second one will. I created the second line to test my sanity [and the binding].
In the viewmodel I've exposed a
that I had initially bound to the combobox column's ItemsSource. However, when the column failed to display any data I removed it to see if that made a difference. With the List bound to the ItemsSource there was no value for the bound ExpenseCategory property and nothing in the list of values. That XAML was simply:
Thanks for the reply. I've been crawling my way towards that solution by incrementally melding some of the elements of Julie Lerman's approach with a DataGridComboBoxColumn, just hadn't gotten all the way to the one you've suggested. However, I've just tried your code and it works. Much more concise.
Probably should have mentioned in the original question that I'd taken the [non-working] syntax directly from MSDN's latest example for combo box columns, and that had me flummoxed.
I need to have a RichTextBox like input control to use in an application like MS Word. But the challenge is to input text diagonally. Currently I used a RichTextBox and a TextEffect for Runs in Document property of the RichTextBox to show text diagonally and it works. Unfortunately the cursor appears in its original position and direction so the user will be confused what he edit and where he type. Can you help me?
Then you need to put the RichTextBox inside of another border and remove the border from the RichTextBox itself. Then apply the RotateTransform to just the inner RichTextBox. Will give the illusion of a horizontal RichTextBox with diagonal text.
You might also be able to modify the control template of the RichTextControl itself so you don't need the 2nd border.
In the XAML when I use mouse to select some text everything highlights fine. But when I click an element in the design I do not see it highlighted in the XAML. I've searched this in the options but I can't find it.
I usually find this is an issue for two reasons:
- A (dependency) property on a control is not being set in the default or specified style. This usually happens most on custom controls or controls where I have overridden the default template. Specifying a default value for a property in the default style will usually make this one go away.
- A custom control (or extended control) doesn't handle the binding to a null object correctly. If, for example, you have something bound to a property on a view model but that property is a nullable type, in design mode it will probably be null. When the design surface mocks the VM to present a design-time view, the property evals to null and can throw an exception if the control doesn't handle it properly. If it is a control you wrote/overrode, you can fix it by handling a null value bound to the offending DP. Otherwise, add design-time code to provide a valid value for the offending VM property. (If you are using a framework like MVVMLight, IsInDesignMode is part of the VM base class. Otherwise, System.ComponentModel.DesignerProperties.GetIsInDesignMode will tell you.
Beyond this, good luck. Xaml designer exceptions are especially painful to try to decode. It won't make you feel any better but I've even had the design surface crash repeatedly but clear up after a reboot.
It usually gives you a pretty damn good hint as to what's wrong. Either in the error dialog or red / blue squiggles. It's entirely possible to have your XAML squiggled without seeing the error dialog. Some people like to ignore those squiggles, but 11 times out of 10, they indicate a real problem.
If you aren't getting an error dialog or squiggles, you can add a global exception handler to your app and pop up a message box, do a full re-build and restart Visual Studio. When it loads your XAML and gets the exception, it'll pop up the message box.
You are probably accessing something that isn't available / initialized yet at design time.