|
I have "Visual Studio Web Authoring Component", but that was installed with VS2008.
.45 ACP - because shooting twice is just silly ----- "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 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Found this thread - it might help you.
Note: The workaround suggests that if VS2010 is run in administrator mode, this problem goes away.
|
|
|
|
|
Nope - it has no effect. I wonder if it's because I have VS2008 and all the SL3 stuff installed...
.45 ACP - because shooting twice is just silly ----- "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 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: VS2008 and all the SL3
I had VS2008 installed and debugging VS 2008 did not create any issues for me.
I was however using SL3 even in VS2010 - so it could be something to do with having the SL3 and SL4 tools installed together.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Look at the OP - I found out what was wrong.
.45 ACP - because shooting twice is just silly ----- "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 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Cool. Thanks for posting the solution here.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Hai all
I am using wpf reporting . While Printing the XamDataGrid with Infragistics.Reports i need to print it with border .
can anyone help me .
thank you
modified on Saturday, July 3, 2010 6:58 AM
|
|
|
|
|
I've been messing around with C# for about a year or so and I thought I'd have a look to see what WPF is all about. However I'm having a problem. Here's the problem -
If I drag a control (Button, TextBox TextBlock ,whatever) and I try to access the FontFamily property in the Poperties window then the designer will crash with the following error -
System.ArgumentException
An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at MS.Internal.FontFace.PhysicalFontFamily.ConvertDictionary(IDictionary`2 dictionary)
at MS.Internal.FontFace.PhysicalFontFamily.MS.Internal.FontFace.IFontFamily.get_Names()
at System.Windows.Media.FontFamily.get_FamilyNames()
at MS.Internal.Services.WPFFontPlatformService.GetFontFamilyName(FontFamily fontFamily)
at MS.Internal.Services.WPFFontPlatformService.GetSupportedFamilyNames()
at MS.Internal.Designer.PropertyEditing.Editors.FontEditor.FontList.Refresh(EditingContext context)
at MS.Internal.Designer.PropertyEditing.Editors.FontEditor.FontList.GetEnumerator()
at MS.Internal.Data.EnumerableCollectionView.LoadSnapshotCore(IEnumerable source)
at MS.Internal.Data.EnumerableCollectionView..ctor(IEnumerable source)
at MS.Internal.Data.ViewManager.GetViewRecord(Object collection, CollectionViewSource cvs, Type collectionViewType, Boolean createView)
at MS.Internal.Data.DataBindEngine.GetViewRecord(Object collection, CollectionViewSource key, Type collectionViewType, Boolean createView)
at System.Windows.Data.CollectionViewSource.GetDefaultCollectionView(Object source, Boolean createView)
at System.Windows.Data.CollectionViewSource.GetDefaultCollectionView(Object source, DependencyObject d)
at System.Windows.Controls.ItemCollection.SetItemsSource(IEnumerable value)
at System.Windows.Controls.ItemsControl.OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
at System.Windows.StyleHelper.InvalidateDependents(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, FrugalStructList`1& dependents, Boolean invalidateOnlyContainer)
at System.Windows.StyleHelper.OnTriggerSourcePropertyInvalidated(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, DependencyPropertyChangedEventArgs changedArgs, Boolean invalidateOnlyContainer, FrugalStructList`1& triggerSourceRecordFromChildIndex, FrugalMap& propertyTriggersWithActions, Int32 sourceChildIndex)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at MS.Internal.Designer.PropertyEditing.Automation.AutomatedChoiceEditor.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at MS.Internal.Designer.PropertyEditing.FromExpression.Framework.ValueEditors.ChoiceEditor.OnApplyTemplate()
at System.Windows.FrameworkElement.ApplyTemplate()
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
at System.Windows.UIElement.Measure(Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
---
If the properties window is in "categorized" mode then all of the categories are open except the "Text" category. Any attempt to open that category will crash the designer also, (obviously because it contains the TextFamily property).
Anyone have a clue what is going on? I have tried to do a Repair on the Visual Studio installation but that didnt sort it out. I'm using VS2010 by the way. I also have VS2008 installed and that doesnt suffer from the problem.
TIA
mick
|
|
|
|
|
Make sure to do not add more than one item with the same identifier or key
|
|
|
|
|
I have a WPF application which contains a ListView defined to show the values for an item in a chart.
One of the fields, State, is supposed to change as the charted values cross warning and alarm barriers.
I built up the list (which was really only one item) as follows:
ObservableCollection<LegendValues> itemList = new ObservableCollection<LegendValues>();
LegendValues item = new LegenValues();
... define the initial values ...
itemList.Add( item );
myListView.ItemsSource = itemList;
item.State = "Warn";
I also have the binding set in XAML as TwoWay.
When I change the state in the item object, it does not change in the ListView. Is there something I'm missing?
Thanks,
Michael
|
|
|
|
|
Michael Eber wrote: Is there something I'm missing?
INotifyProperty perhaps?
|
|
|
|
|
Well...according to the documentation all I need are two things. TwoWay link on the binding between the ItemSource object and the ListIndex, and the ObservableCollection. But I can add INotifyProperty and see if that helps.
|
|
|
|
|
ObservableCollection is only used to tell the binding engine when records have been added or removed from the collection. In order to watch changes to particular properties, you need to use INotifyPropertyChanged and raise the PropertyChanged event.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Have a read up on MVVM, in particular anything to do with the ViewModel portion of that design pattern and as Pete said it's all about the object INSIDE your ObservableCollection.
|
|
|
|
|
try to do add Updatesourcetrigger = Propertychanged to the xaml in addition to the two way, make sure that the object source bound property implement the INotifyPopertyChanged or is a dependency property
|
|
|
|
|
I am having an issue and have scoured the net looking for an answer and I still have yet to find one so I thought I would post here while continuing my search. I simply want to set SelectedItem to a string value and have it select that item from the combobox. Now I am adding my items to the combobox statically during design time and when I do this, SelectedItem doesn't work and always is null. However I just found out that when I add my combobox items during runtime, selectedItem works just fine. Now I would like to know why this is. I am guessing that it is some binding that automatically happens when adding them dynamically, but I would love to know how to get this working statically. Thanks!
|
|
|
|
|
Please specify which version of the framework you are using. Assuming that this is a WPF application.
|
|
|
|
|
Sorry this is WPF and I am working in VS2010 .Net 4.0.
|
|
|
|
|
hello
newbie to WPF, how do you set selected item for a list box?
<br />
SomeDataTab.Columns.Add("SomeData", typeof(string));<br />
SomeDataTab.Columns.Add("IsSelected", typeof(bool));<br />
<br />
Cmd = new SqlCommand(SQL, (SqlConnection)DevConn);<br />
...<br />
Rdr = Cmd.ExecuteReader();<br />
while (Rdr.Read())<br />
{<br />
rw = SomeDataTab.NewRow();<br />
SomeData = (string)Rdr["SomeData"];<br />
if (SomeData == "TEMPLATE_OBJECTIVE")<br />
{<br />
SomeData = "SharedData";<br />
rw["IsSelected"] = true;<br />
}<br />
else<br />
{<br />
rw["IsSelected"] = false;<br />
}<br />
rw["SomeData"] = SomeData;<br />
SomeDataTab.Rows.Add(rw);<br />
}<br />
<br />
SomlstSomeData.DataContext = SomeDataTab.DefaultView;<br />
The above code shows how we bind to DataTable and following is xaml code:
<ListBox Name="lstSomeData" Grid.Row="0" Grid.Column="0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}" />
<Label Content="{Binding SomeData}"></Label>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
I wish to know how to pre-select say an Item with value "AAA"?
Thanks!
dev
modified on Sunday, July 4, 2010 9:47 PM
|
|
|
|
|
Is that you require something like this
[Code]<Grid>
<ComboBox Margin="37,31,299,251">
<ComboBoxItem IsSelected="True" Content="One"></ComboBoxItem>
<ComboBoxItem Content="Two"></ComboBoxItem>
<ComboBoxItem Content="Three"></ComboBoxItem>
</ComboBox>
</Grid>[/Code]
This code will show One item as selected by default at the compile time and not after firing the application
|
|
|
|
|
thanks but no, the list is built dynamically by binding to it a DataTable as shown in my code fragment
dev
|
|
|
|
|
You can do this progammatically by using the IsSelected = true of the given MenuItem in the code behid too if I well understand the question, I mean you can test the value AAA using the selected value property of the combo box and then set the IsSelected property of the corresponding item to true
|
|
|
|
|
Thanks no not really... In another post I've added more detail - basically (copied from there), I'm using CodePlex WPF ComboBox and is having trouble pre-select item
From code behind, I bind the combo box to a DataTable with two columns:
...
SomeTableSrc = new DataTable("SomeData");
SomeTableSrc.Columns.Add("Data", typeof(string));
SomeTableSrc.Columns.Add("IsSelected", typeof(bool));
lstSomeData.DataContext = SomeTableSrc.DefaultView;
Xaml:
<Style TargetType="{x:Type ComboBoxItem}">
</Style>
The above will select relevant "ComboBoxItem" (and it works fine, if you click on ComboBox, as menu expands you can see desired items actually get selected), *** BUT *** "SelectedValue" or "Text" of "ComboBox" (not items) remains blank - and setting these "ComboBox" attributes directly just don't work.
// Don't work, "ComboBox" text remains blank
lstSomeData.SelectedValue = "ABC";
// Don't work, "ComboBox" text remains blank
lstSomeData.Text = "ABC";
dev
modified on Wednesday, July 7, 2010 10:09 PM
|
|
|
|
|
Be gentle - this is all new to me!
OK - I have the below sitting on a user control - four progress bars and a text box.
I want the progress bars to each size to the width of the stackpanel - as you can see I have tried 4 different methods - only one of which comes close to doing what I want!
progressBar1 and 3 both appear tiny - despite the width being bound. I have noticed that changing the HorizontalAlignment to 'Stretch' changes that behaviour - but I'm confused!
progressBar2 stretches off the canvas and is clipped. Fair enough, I guess, it's the same width as the panel but starts somewhat to the right, so runs over to the right.
progressBar4 is a mystery to me. It's bound to the ActualWidth of textbox1 - which is pretty thin yet the progress bar appears quite wide - apparently arbitrarily wide?
What gives?
What I was actually trying to do was to have a couple of progress bars, one above the other, 'docked' so that they stretched width-ways with a resizing of the user control.
I suspect that the solution is obvious - so I'll make my excuses now. It's been a long week, and it's beer-o-clock - but what I'm really after is not only a solution, but a pointer to some sort of explanation as to what is going on in the layout.
<StackPanel x:Name="p1" Margin="10">
<ProgressBar Margin="12" Name="progressBar1" Height="18" Width="{Binding ElementName=p1, Path=Width}" HorizontalAlignment="Left" />
<ProgressBar Margin="12" Name="progressBar2" Height="18" Width="{Binding ElementName=p1, Path=ActualWidth}" HorizontalAlignment="Left" />
<ProgressBar Margin="12" Name="progressBar3" Height="18" Width="{Binding ElementName=textBox1, Path=Width}" HorizontalAlignment="Left" />
<ProgressBar Margin="12" Name="progressBar4" Height="18" Width="{Binding ElementName=textBox1, Path=ActualWidth}" HorizontalAlignment="Left" />
<TextBox Height="18" Name="textBox1" Margin="12" HorizontalAlignment="Left" />
</StackPanel>
Thanks, in anticipation of enlightenment,
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Right - an explanation as to what's going wrong:
<ProgressBar Margin="12" Name="progressBar1" Height="18" Width="{Binding ElementName=p1, Path=Width}" HorizontalAlignment="Left" /> Drop the HorizontalAlignment, that's overriding the Width.
Secondly - this binds to the ActualWidth, but the Margin has an effect, so the actually means that the progress bar extends beyond the margin of the stack panel. Drop the Width setting altogether as it's not needed.
<ProgressBar Margin="12" Name="progressBar2" Height="18" Width="{Binding ElementName=p1, Path=ActualWidth}" HorizontalAlignment="Left" /> If you change all this to the following, you get to see the actual effect of what you are doing:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel x:Name="p1" Margin="10">
<ProgressBar Margin="12" Name="progressBar1" Height="18" Width="{Binding ElementName=p1, Path=Width}"/>
<ProgressBar Margin="12" Name="progressBar2" Height="18" />
<ProgressBar Margin="12" Name="progressBar3" Height="18" Width="{Binding ElementName=textBox1, Path=Width}" />
<ProgressBar Margin="12" Name="progressBar4" Height="18" Width="{Binding ElementName=textBox1, Path=ActualWidth}" />
<TextBox Height="18" Name="textBox1" Margin="12" HorizontalAlignment="Left" Width="20" />
</StackPanel>
</Page>
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|