|
|
I want to add some custom properties as well as the existing properties should remain same in the controls.
Some of the controls can have the extended properties, but some controls like Textblock are sealed so can not be able to inherit other controls from the existing control.
Anybody have any idea that how can we extend the exisiting silverlight control's properties?
Thanks in advance...
|
|
|
|
|
If you want to extend an existing control, I'd look to use an Attached Property.
|
|
|
|
|
I have tried it with two ways:
1. Inheriting from teh existing control and add our custom property to it, include it in the xaml page as a new namespace and use it.
But it is not working in the case when the control class is sealed for example Textblock....
2. Created a wrapper class having the TextBlock and my custom property.Initialize the Textblock in constructor,include it in the xaml page as a new namespace and use it.
But it is also not working in the case when we give the "x:name" to that control...
No other idea how to do?
|
|
|
|
|
|
|
I'm not sure how many different ways to say this. Perhaps I need to shout here. USE ATTACHED PROPERTIES. That's it - full stop, finito. That's the WPF/Silverlight way of doing things.
There are very few instances where you need to subclass existing controls.
|
|
|
|
|
Pete O'Hanlon wrote: USE ATTACHED PROPERTIES. That's it - full stop,
easy, pete. sometimes, people just don't listen.
|
|
|
|
|
Thanks for ur kind support....
I didn't know about the attached properties, but now it become very useful for me...
|
|
|
|
|
I wrapped a class to call win32 api functions, use GetPrivateProfileString to get values in ini file.
it works in Unit Test, but does not work called in WPF window.
My project based on .NET FW 3.0, without any SP.
anyone know how to solve this?
Glad to discuss with you and best wishes.
|
|
|
|
|
If it works in a unit test, there's no reason it shouldn't work in WPF. I wouldn't use this API though, if I were you, because it's designed to provided compatibility with 16 bit applications. You should look to use either the registry or a config file for your settings.
|
|
|
|
|
Pete O'Hanlon wrote: If it works in a unit test, there's no reason it shouldn't work in WPF.
Agree with you, but it true, it happened.
Pete O'Hanlon wrote: You should look to use either the registry or a config file for your settings.
I intend to write my classes to read\write ini file. I prefer to ini files than xml file as config file.
Glad to discuss with you and best wishes.
|
|
|
|
|
Without seeing your project, there's not a lot I can suggest.
|
|
|
|
|
I've just uploaded the latest version of MoXAML PowerToys, complete with the Scrubber utility from Kaxaml - Robby said he wanted a version of Scrubber that worked in VS and I was glad to be able to help. You can get this here[^]:.
This version of Scrubber allows you to update all of the XAML in a project from a single menu option.
|
|
|
|
|
Hi everyone ,
haven't read much about WPF , just some basic stuff .
Is it possible to simulate first person movement in a WPF application ? can i dinamically move the view point or something like that to simulate this ? Like first person shooters , but without the shooting part . Just simulate the walk around a room ..
Thank you !
|
|
|
|
|
You can - WPF goes way beyond what you can do in WinForms and does allow you to work in a 3D environment. I'm not sure that you wouldn't be better off using Managed DirectX though.
|
|
|
|
|
Thank you so much ! I'll start digging in
|
|
|
|
|
You developing on Microsoft SQL Server 2008 or Microsoft User Experience technologies including Silverlight, Windows Presentation Foundation, Windows Vista or IE8?
Front Runner for Innovate On, is Microsoft's early adopter program that helps you get to market faster, giving you both technical and marketing support. Here are some of the benefits from joining Front Runner:
- Targeted Training
- Telephone Technical Support
- Test Fee Waiver
- Project Planning Support and Consulting
- Free Hosting
- Ready-to-go Marketing Campaign
- Front Runner for Innovate On Badge
- Public Relations Templates
- Microsoft Advertising Campaign
- Credit Toward Marketing Activities
- Discounted Case Studies
Sign up today here.
ISV Innovation provides a comprehensive collection of online training geared towards ISVs and developers creating business applications on Microsoft technologies including SQL Server, Microsoft Silverlight, Windows Presentation Foundation, Windows Internet Explorer 8, and Windows Vista.
Subscribe to our monthly newsletter to hear about all the latest training.
|
|
|
|
|
Thanks Bruce - that's highly interesting.
|
|
|
|
|
|
Hello Dudes =)
I want Bind a ComboBox to 2 DataSets/DataTables. One with a Countries list other with myUser data (this always with just 1 line)
the combo list the countries ok, but i dont find the way to bind de SelectedValue to de myUser data...
If I chage it to:
SelectedValue="{Binding ElementName=stData, Path=DataContext.OriginCountryIDColumn, Mode=TwoWay}"/>
The Binding find something to work with, but give me "A TwoWay or OneWayToSource binding cannot work on the read-only property 'OriginCoutryIDColumn' of type 'dtDAL.dsData+UsersDataTable'."
I take the "Mode=TwoWay" out and error persist
I change to "Mode=OneWay" and the SelectedValue don't get the value from the datatable
Can someone turn the light on please?
<pre>
<Page x:Class="DUError"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dt="clr-namespace:WebSGTA"
xmlns:tk="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="DU" MinWidth="300" MinHeight="300" Margin="5,5,5,5" >
<Grid>
<StackPanel Name="stData">
<Grid Name="gdTopo">
<Grid.RowDefinitions>
<RowDefinition Height="55" />
<RowDefinition Height="55" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100*" />
<ColumnDefinition Width="20*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.Row="0" Grid.ColumnSpan ="1" BorderBrush="Gray" BorderThickness="1">
<StackPanel >
<Label>Origin</Label>
<ComboBox Name="cmbCountry"
ItemsSource="{Binding}"
SelectedValuePath="CountryID"
DisplayMemberPath="CountryName"
SelectedValue="{Binding ElementName=stData, Path=DataContext.OriginCountryID, Mode=TwoWay}"/>
</StackPanel>
</Border>
</Grid>
</StackPanel>
</Grid>
</Page>
</pre>
<pre>
Sub Bindings()
Dim dsBase As New dtDAL.dsBase
Dim dsData As New dtDAL.dsData
dsData.Merge(dtDAL.dtSQLSGTA.DataGet(1, 1))
dsBase.Merge(dtDAL.dtSQLSGTA.BaseGet(1, 1))
stData.DataContext = dsData.Users
cmbCountry.DataContext = dsBase.Countries
End Sub
</pre>
|
|
|
|
|
Help wanted clipping an image region and saving as new image....
Can someone please help me.
What I what to do is display a picture (image) and drawer a clip region using the mouse on a selected area on the image, this could be a retangle, square or a freehand shape.
I can display the image and clipped region using WPF as below. But what I cannot work out is how to save the clipped region of the image as a new bitmap image. The same problem if I create a image using pathgeometry, I cannot work out how to save the cropped part of the image.
If there is an alternative method instead of using WPF, please advice me.
c# or vb I don't mind, I just need a solution.
Thanks
// Sample 4
// Create the image to clip.
Image myImage = new Image();
Uri imageUri =
new Uri(@"C:\\Documents and Settings\\All Users\\Documents\My Pictures\\Sample Pictures\\Water lilies.jpg", UriKind.Relative);
myImage.Source = new BitmapImage(imageUri);
myImage.Width = 200;
myImage.Height = 150;
myImage.HorizontalAlignment = HorizontalAlignment.Left;
// Use an EllipseGeometry to define the clip region.
EllipseGeometry myEllipseGeometry2 = new EllipseGeometry();
myEllipseGeometry2.Center = new Point(100, 75);
myEllipseGeometry2.RadiusX = 100;
myEllipseGeometry2.RadiusY = 75;
myImage.Clip = myEllipseGeometry2;
|
|
|
|
|
|
I'm trying out Infragistic's WPF controls, and I got this problem:
I'm using XamDataGrid, and I set its DataSource to a DataTable.DefaultView.
The problem starts when I try to add/update/delete any of the rows. I don't expect it do it magically by itself, but I can't seem to find a reasonable mechanism for accomplishing this task.
Any idea what am I missing?
To hell with circumstances; I create opportunities.
|
|
|
|
|
Oh... some one else is annoyed with the same thing, too?
To hell with circumstances; I create opportunities.
|
|
|
|