|
About the DC? Yes, I assigned it.
This window is working. It's just THIS piece that's not working.
If it's not broken, fix it until it is
|
|
|
|
|
I asked how have you assigned the DC, not have you assigned it? It's entirely possible that you have created it after the Activated event has fired.
|
|
|
|
|
oh oh, my bad. I'm sorry. I totally missed the word 'how'
I did it in the code behind after the InitializeComponent.
If it's not broken, fix it until it is
|
|
|
|
|
It's my fault - I just reread your post - the getter is being hit, so the DataContext has been hooked up.
In order to test your Activated event, bring another window to the front and then reselect your application. See if it fires then (it should).
|
|
|
|
|
You're right - it fired AFTER I re-activated it.
It just doesn't fire on startup, which is what I want.
[UPDATE]
According to this[^]
the Window is activated when "The window is first opened."
The Activate command fires AFTER I lose and regain focus, but not on first startup.
[UPDATE 2]
I replaced the command with the event subscription in the code begind and it DOES fire on startup, so for some reason the command isn't firing until later on.
If it's not broken, fix it until it is
modified 3-Mar-14 18:57pm.
|
|
|
|
|
FYI - Resolved this using the Loaded event.
If it's not broken, fix it until it is
|
|
|
|
|
Hmmmm. Downvote countered.
|
|
|
|
|
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
|
|
|
|
|
Well, you could always look at using an EventAggregator.
|
|
|
|
|
Kind of a newbie question. In my XAML I have these 2 lines
<DataGridComboBoxColumn SelectedItemBinding="{Binding ExpenseCategory}" Header="Category" />
<DataGridTextColumn Binding="{Binding ExpenseCategory}" Header="Category"/>
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
List<string> 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:
<DataGridComboBoxColumn SelectedItemBinding="{Binding ExpenseCategory}" ItemsSource="{Binding ExpTypes}" Header="Category"/>
So...what am I missing here? Why won't the combobox column display my data?
|
|
|
|
|
FWIW - and I have no idea if this is even close to an optimal approach - I found this solution in an old article by Julie Lerman http://msdn.microsoft.com/en-us/magazine/gg983481.aspx[^]
<DataGridTemplateColumn Header="Category" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=ExpenseCategory}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<Grid FocusManager.FocusedElement="{Binding ElementName= taskCombo}" >
<ComboBox x:Name="taskCombo" SelectedItem ="{Binding Path=ExpenseCategory}"
IsSynchronizedWithCurrentItem="False"
ItemsSource="{Binding ExpTypes, Source={StaticResource vm}}"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
In her article she explains that the Grid FocusManager is used to manage the events when a new row is created and the user's first click is in the combobox.
This approach seems to work OK, but it is far from straightforward and I hope that somebody here has a better solution that would allow the DataGridComboboxColumn to work for me.
|
|
|
|
|
How about combining the two approaches? Since you've already managed to get the viewmodel into a static resource, something like this should work:
<DataGridComboBoxColumn
SelectedItemBinding="{Binding ExpenseCategory}"
ItemsSource="{Binding ExpTypes, Source={StaticResource vm}}"
Header="Category"
/>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
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.
|
|
|
|
|
Bonjour,
I'm using Avalondock in my project.
I'm trying to restore a layout saved in a xml file.
All is right.
But hidden Anchorable layout are not showed even if they are defined in a visible layout.
Could you help me ?
Thanks a lot.
|
|
|
|
|
Hello everyone.
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?
|
|
|
|
|
TextEffect just affects the text. If you apply a RotateTransform to the control, you'll rotate the entire control (including the caret).
|
|
|
|
|
Thank you SledgeHammer01. That's right, but I want to have diagonal lines not diagonal textbox.
|
|
|
|
|
You said you wanted a diagonal textbox. Diagonal input & Diagonal caret???
|
|
|
|
|
I need a portrait style RichTextBox but with diagonal lines (input and display)
|
|
|
|
|
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.
|
|
|
|
|
I am using this[^] theme.
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.
Anyone know how to change this?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Hello,
how to make ScrollViewer with non scrollable band on left, or how to make partially non scrollable control?
Thank you.
|
|
|
|
|
I am struggling with the syntax to get the TextTemplate from a static resource.
<Selectors:RuleAttrSelector.TextTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="500" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource GridCellRight}"
Text="{Binding Path=Label}"
VerticalAlignment="Center" />
<TextBox Grid.Column="1"
Text="{Binding DisplayValue}"
Style="{StaticResource ReadOnlyTextBox}" />
</Grid>
</DataTemplate>
</Selectors:RuleAttrSelector.TextTemplate>
I need this template selector to be reused in multiple forms but cannot work out the correct syntax.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I ListView Control I filled in a Click bouton.Et what I want is to control the lines of the ListView rows that contain the same elements as in the image below.
here is the link for the image.
http://social.msdn.microsoft.com/Forums/getfile/417417.
this is "Inventory Management" genre ie if a product exists, it increases the amount, if we insert the new quantity but not in a database, but rather in a ListView
I already do this last code to check if there are double lines but it does not work
AddArticleCollection.Add(new ArticleModel {
ID = txtIDProduit.Text,
Design = txtDesigProduit.Text,
Qte = int.Parse(txt_qte_produit.Text),
PrixVente = double.Parse(txtPUProduit.Text)
});
foreach (var item in AddArticleCollection)
{
if (ListVarticle_pr_vend.Items.Contains(item))
{
InfoBox info = new InfoBox("trouvé");
info.ShowDialog();
}
else
{
ListVarticle_pr_vend.Items.Add(item);
}
}
I thank you in advance and sorry for my english twisted.
|
|
|
|
|
Everything is wonderful. Then all of a sudden, it starts throwing exceptions...in the Designer.
The app itself compiles fine, runs fine, I just can't see any of the user controls because of index out of range and the like.
Duh. How can I have an SelectionChanged event coded if it keeps objecting to me using the SelectedIndex property in it?
Yeah, yeah, I know.
But why has it worked fine for months and now it doesn't? Some magic setting somewhere I accidentally set or unset?
VS2012, C#
|
|
|
|