|
John - have a play round with this on your Repeat button (ensuring that you also set HorizontalScrollBarVisibility="Auto" on the ScrollViewer):
Visibility="{Binding Path=ComputedHorizontalScrollBarVisibility, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
"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
|
|
|
|
|
Hmmm. I'll give that a shot. It's not gonna make the scrollbar visible though, is it?
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
Solved - In the CS file, get the scroller from the tab control, get the buttons from the scroller, and add event handlers to manipulate their enabled status'. If there's a XAML way to do this, I couldn't find it.
Comparing scroller.HorizontalScrollExtent with scroller.ScrollableWidth to see if they're the same.
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
Iam moving my application from MFC to .net wpf . I need to use the bussiness logic dll`s in c++, modifying onli the UI part of it.
I need to get the device context of the control for the same.
Can anyone let me know how to get the device context for a wpf control.
Thanks
|
|
|
|
|
WPF doesn't use device contexts - doesn't really use HWNDs
on the surface either.
WPF is not GDI!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I was able to get the DC of the window and draw the image in the window loaded event . The thing is the image is not getting retained, its getting redrawn which erases the image again.Any idea like how to overcome this one..
|
|
|
|
|
krishnan.s wrote: Any idea like how to overcome this one..
Yes - Use WPF.
Why use WPF if you're using GDI?
WPF "windows" may be ultimately backed by an HWND, but beyond that everything
is done with a completely different rendering engine.
You should be able to find an equivalent, if not much more robust, way
to do everything in WPF that you are doing with GDI, if you choose to do so.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm using BitmapMetadata.GetQuery() to get metadata from JPEG files just fine with queries like the following, for example, to get the creation date: "/app1/ifd/exif/subifd:{uint=36867}". But when I use the same query string with a .TIFF file, I get nothing back. Every query I make on the TIFF file fails.
I know the TIFF file has the metadata in it I'm seeking because I can see it through the Windows Explorer when I hover over the file name. Here is the code I'm using to read the metadata and the debugger shows me that the BitmapSource I get back from the TIFF file has metadata in it, but the GetQuery() returns null. Should the query string somehow be different for the two formats? Any ideas?
BitmapMetadata metaInfo;
Stream imageStream = null;
imageStream = new FileStream(imageUri.LocalPath, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite);
string extension = System.IO.Path.GetExtension(imageUri.LocalPath);
BitmapSource bitmapSource = null;
switch (extension.ToLower())
{
case ".jpg":
JpegBitmapDecoder decoderJpg =
new JpegBitmapDecoder(imageStream,
BitmapCreateOptions.PreservePixelFormat,
BitmapCacheOption.Default);
bitmapSource = decoderJpg.Frames[0];
break;
case ".tif":
TiffBitmapDecoder decoderTif =
new TiffBitmapDecoder(imageStream,
BitmapCreateOptions.PreservePixelFormat,
BitmapCacheOption.Default);
bitmapSource = decoderTif.Frames[0];
break;
default:
break;
}
metaInfo = (BitmapMetadata)bitmapSource.Metadata;
if (metaInfo != null)
{
if (metaInfo.ContainsQuery("/app1/ifd/exif/subifd:{uint=36867}"))
return metaInfo.GetQuery("/app1/ifd/exif/subifd:{uint=36867}");
else
return null;
}
else
{
return null;
}
|
|
|
|
|
I'm not sure what the generic queries are for what you're looking for,
but TIFF uses a different format.
Maybe take a look here: Photo Metadata Policy[^]
You can also use TIFF tag values directly if you're familiar with
the format, e.g.
"/ifd/{ushort=256}" Image Width
"/ifd/{ushort=257}" Image Height
"/ifd/{ushort=305}" Software
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I suspected it was something like this! And that's a great link you provided. Thanks for your timely response. Several years ago I succeeded in doing all this using the Small Animals library. He must hide all these differences because the code I had to write was image-format-independent. I just supplied a file path and and got metadata transparent of the various formats. Earlier today I performed a sanity check by testing the same TIFF images that were failing in my WPF code and they worked in that old MFC app. So I'm off and running on this aspect of my program anyhow. I'm still having trouble in my WPF app transferring metadata from a JPEG that I perform an image transformation on (scaling), but I have a link that supposedly accomplishes this. And by the way, I am familiar with the Metadata Query Language (http://msdn.microsoft.com/en-us/library/aa968944(VS.85).aspx[^])
|
|
|
|
|
fjparisIII wrote: I am familiar with the Metadata Query Language (http://msdn.microsoft.com/en-us/library/aa968944(VS.85).aspx[^])
I am not....thank you for the link!!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: fjparisIII wrote:
I am familiar with the Metadata Query Language (http://msdn.microsoft.com/en-us/library/aa968944(VS.85).aspx[^])
I am not....thank you for the link!!
The section, Property Rules, in the document you referenced gives the location of the link I sent you.
Well, I upgraded my program to read TIFF metadata based on the information in your reference. What a mess that was. Image metadata is in a hopeless tangle and everytime some big company tries to bring order to the chaos by introducing a new way of encoding metadata, it just gets messier because you still have to support all the ugly legacy formats in addition to all the slick and elegant new ones. Elegance piled on elegance piled on kludges, and now my program has all that crud in it.
|
|
|
|
|
|
|
I was googling for something else earlier today, and I accidently used this google phrase:
wpf get control in datatemplate
I'm sure you'll get hundreds of hits. Once you get the control, you should be able to manipulate it any way you wish.
"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." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
|
|
Since you're using an ItemsControl, there's no notion of
"selected items" so you'll have to track that somehow yourself.
I assume you're doing that somehow already if you know certain items
need their listbox selection changed.
Once you have the ItemsControl item(s) which you need to manipulate, for each item
you can get its template and use FindName() to get at its ListBox (you'll need to give
that template ListBox a name).
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Collin Jasnoch wrote: I am not exactly sure what you mean. The Listbox in the template? How can I give it a name? Even if I name it, it is not valid since it is in a DataTemplate.
I was referring to using FindName() to find an element at runtime which was created
through a template (i.e. the "Listbox Inside of a Template"). You'd use x:Name to give
it a name, and find the element with FindName().
If you already have a solution then never mind
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
BTW, I'm still working with your original post where you stated
"I would like a way to remove the selection from specific listboxes."
To do that, you set the listbox's SelectedIndex to -1 (the user can also
do this with Ctrl-Click).
To set the listbox's SelectedIndex to -1, you need the actual listbox object,
which was created via a template, so you use FindName() to get the object at
runtime (since it doesn't exist at design time).
Now you're discussing what you do in response to a listbox's selection changing,
so I'm probably way off topic at this point
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It is simple only. Access the list box items and set the selected index to -1.
e.g.
MyViewModel context = this.DataContext as MyViewModel ;
var results = lstBoxCity.SelectedItems;
bool flag = true;
foreach (RefGeneralValue rval in results)
{
if (rval.RefGeneralValueId == 0)
{
lstBoxCity.SelectedIndex = -1;
flag = false;
break;
}
}
if (flag == true)
{
}
N.B.~ RefGeneralValue is a entity that we are using in our project.
It is as follows (given only for ur reference)
[Serializable]
[DataContract]
public class RefGeneralValue : BaseDomainClass
{
public RefGeneralValue();
[DataMember]
public virtual DateTime? ModifyDate { get; set; }
[DataMember]
public virtual string RefGeneralTypeId { get; set; }
[DataMember]
public virtual string RefGeneralValueCode { get; set; }
[DataMember]
public virtual string RefGeneralValueDescLong { get; set; }
[DataMember]
}
Thanks
Niladri Biswas
|
|
|
|