|
Is it possible to derive from DependencyObject and create a dependency property instead of implementing INotifyPropertyChanged ?
Greetings - Jacek
|
|
|
|
|
|
You would still need INotifyPropertyChanged to notify UI, right?
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Not if the properties are dependency properties.
|
|
|
|
|
I think you can only bind to public properties - make sure Property1 is a public property.
You can also try specifying the DataContext explicitly.
public MyForm()
{
myObject.Property1 = true;
checkbox1.DataContext = myObject;
}
<CheckBox Name="checkBox1" IsChecked="{Binding Property1}" />
|
|
|
|
|
Hi.
I have written below XAML code :
<ScrollViewer Grid.Row="0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<ListView x:Name="ListView1" Background="#FFEEF3FA" GridViewColumnHeader.Click="ListViewSort_Click" ItemsSource="{Binding ListViewItemsCollections}" SelectionChanged="ListView1_SelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn x:Name="GridViewColumnName" Header="Name" Width="200">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image x:Name="ImageListViewItem" Width="16" Height="16" Source="{Binding GridViewColumnName_ImageSource}" />
<Label Content="{Binding GridViewColumnName_LabelContent}" />
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn x:Name="GridViewColumnTags" Header="Tags" Width="100" DisplayMemberBinding="{Binding GridViewColumnTags}" />
<GridViewColumn x:Name="GridViewColumnLocation" Header="Location" Width="238" DisplayMemberBinding="{Binding GridViewColumnLocation}" />
<GridViewColumn x:Name="GridViewColumnVisitCount" Header="Visit Count" Width="0" DisplayMemberBinding="{Binding GridViewColumnVisitCount}" />
<GridViewColumn x:Name="GridViewColumnVisitDate" Header="Visit Date" Width="0" DisplayMemberBinding="{Binding GridViewColumnVisitDate}" />
<GridViewColumn x:Name="GridViewColumnAdded" Header="Added" Width="0" DisplayMemberBinding="{Binding GridViewColumnAdded}" />
<GridViewColumn x:Name="GridViewColumnLastModified" Header="Last Modified" Width="0" DisplayMemberBinding="{Binding GridViewColumnLastModified}" />
</GridView>
</ListView.View>
</ListView>
</ScrollViewer>
As you can see the name ImageListViewItem exists in the code , but whenever I'm gonna compile the project I receive this error :
Error 1 The name 'ImageListViewItem' does not exist in the current context D:\My Works\C#\WPF\MainWindow.xaml.cs 704 29 passwordManager
What's wrong with it ?
Could you please guide me ?
Thanks.
|
|
|
|
|
Do a build -> clean solution and then try again.
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
I've done it, Unfortunately I receive the error again
|
|
|
|
|
You can try one more thing - copy your entire code, delete this xaml file, add a new one and paste this code in there. It sounds a little crazy, but once in a way it works. The reason is, the temporary code file created for this xaml may have this ImageListViewItem reference missing.
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Thanks.
But I found another way :
Image img = FindName("ImageListViewItem") as Image;
It works.
|
|
|
|
|
I tested your way. It doesn't work
I receive these errors :
Error 1 The name 'Image_GridViewColumnName' does not exist in the current context
Error 2 Unknown build error, 'Could not find file 'D:\My Works\C#\WPF\passwordManager\obj\Debug\passwordManager.exe'. Line 8 Position 2.'
BTW: I have changed the name to Image_GridViewColumnName
|
|
|
|
|
I agree with the previous poster. Clean the solution, delete the bin and obj folders in each project folder, then rebuild the solution. I tried your XAML and, after I added the event handlers, everything compiled fine.
|
|
|
|
|
The problem you've hit is that you have the name of this item in a cell template. WPF needs to do some tricks to prevent name collisions - hence you can't directly reference this item. You need to read up on name scopes[^].
"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
|
|
|
|
|
if i compile my wpf project in xp
and execute it on vista.
will it be executing normally.
i had an experience it from windows form application. it was not ruing on vista. i faced color combination problem.
|
|
|
|
|
It's not WPF that you need to consider, but rather whether or not your application violates any of the rules that have been put in place in Vista as a result of the security elevation.
"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
|
|
|
|
|
As Pete said it is a significatly difference security model between these two OSes. Make sure your app doesn't write to it's private installation location and in stead writes to Application Data, that sort of thing.
|
|
|
|
|
Hi Friends
i have created a loader user control in wpf now i want to show loader when calling Webservice and after i get responce i should collapse the Loader control. but it not working what should i do.
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
wasimsharp wrote: but it not working what should i do.
What's not working?
Make sure your web service is called asynchronously so the UI thread
can show the control. That's just a guess based on the complete lack of
information in your post.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am attemptimg to programmatically highlight a selection of text in a textbox.
I trying to achieve this by so doing:
tbxItemUrl.SelectionStart = 0;
tbxItemUrl.SelectionLength = pageDetailItemSection.tbxItemUrl.Text.Length;
tbxItemUrl.SelectionBackground = new SolidColorBrush(Colors.Yellow);
tbxItemUrl.SelectionForeground= new SolidColorBrush(Colors.Black);
but to no avail.
some resources...i have attempted to try
[][^]
Has anybody successfully managed to do this...thanks
|
|
|
|
|
I did not have to search far[^]. Hope it helps !
There are only 10 types of people in this world — those who understand binary, and those who don't. |
modified on Friday, January 8, 2010 1:02 PM
|
|
|
|
|
Also, your code probably didn't work because the TextBox didn't have focus.
This worked for me:
System.Windows.Browser.HtmlPage.Plugin.Focus();
tbxItemUrl.SelectionStart = 0;
tbxItemUrl.SelectionLength = tbxItemUrl.Text.Length;
tbxItemUrl.SelectionBackground = new SolidColorBrush(Colors.Yellow);
tbxItemUrl.SelectionForeground = new SolidColorBrush(Colors.Black);
tbxItemUrl.Focus();
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the replies.
Really appreciated.
The focus definitely works, thank you, however i have multiple textboxes that i am looking for matches in and would like to highlight any matches in all the necessary textboxes.
Setting the focus would only then highlight 1 textbox.
Any suggestions would be welcome.
Thanks again.
|
|
|
|
|
You'll need to do highlighting something like
Abhinav S linked to above.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Check this: http://forums.silverlight.net/forums/p/137089/306336.aspx
modified 27-May-14 4:58am.
|
|
|
|
|
Hi,
Is there any way to find out gradient colors and stops from image?
I have mockups of screen from my user experience guy. From those i want to find out gradient stops (points) and colors he used. currently I am using Paint.net and expressing blend and getting the colors creating them in XAML for the same. GradientStops are the biggest challenge.
Thanks
|
|
|
|