Click here to Skip to main content
15,121,414 members

Comments by KiranBabu M (Top 54 by date)

KiranBabu M 27-Jan-12 1:14am View
   
Load images in to the Listbox using data virtualization.
KiranBabu M 23-Jan-12 6:01am View
   
it is not working if i make SelectionMode="Multiple"
KiranBabu M 23-Jan-12 5:33am View
   
actually i want to include another control in the scroll viewer along with the listbox but i have not updated here.
KiranBabu M 12-Jan-12 6:07am View
   
what do u want to know in the above code?
KiranBabu M 12-Jan-12 6:03am View
   
can u specify clearly what the problem u r facing when u execute the above code.
KiranBabu M 12-Jan-12 0:39am View
   
Deleted
see this for java script
KiranBabu M 12-Jan-12 0:34am View
   
my 5
KiranBabu M 20-Dec-11 2:42am View
   
How can we bind only only the number of images not much more than the number visible on a screen to the listbox itemsource and change the binding as user scrolls
KiranBabu M 20-Dec-11 2:37am View
   
I think virtualizing the Listbox is the solution.
Do we need to implement some logic to only load the no. of images same as the number visible on the listbox. or
setting this properties will take care of that..
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling".
ScrollViewer.IsDeferredScrollingEnabled="True"
KiranBabu M 20-Dec-11 2:11am View
   
Actually these images are the frames of the video. iam extracting the frames of a video and storing as .jpg in a Directory.
After this iam loading these images in to a listbox so that user can select any imagefrom listbox and edit the frame.
KiranBabu M 12-Dec-11 7:27am View
   
can u Post your code?
KiranBabu M 22-Nov-11 4:26am View
   
Rect rectBounds = VisualTreeHelper.GetContentBounds(Visual reference);
KiranBabu M 21-Nov-11 8:12am View
   
Here i have multiple images. i want to render image and shapes on the canvas and copy the shapes to all the images in the list. when i select the image the image and copied shapes should render on the canvas. Up to here it is O.K ,
now i want to generate events to the shapes.
This i have been trying but not successful.

Plz can u provide any example to understand.
KiranBabu M 21-Nov-11 3:37am View
   
Thanks for the reply,
Here i want to handle events for shapes that is drawn using DrawingContext only.
KiranBabu M 18-Nov-11 8:18am View
   
yes
event handlers are in Xaml.
when i run i cant see the canvas color
KiranBabu M 18-Nov-11 1:18am View
   
ya i have tried changing different backgrounds but still it is not working.
KiranBabu M 16-Nov-11 6:51am View
   
Thanks Rob..!
KiranBabu M 16-Nov-11 6:04am View
   
true,
but can we Override onRender method for a XAML canvas?
KiranBabu M 16-Nov-11 5:54am View
   
so,
we cannot override a OnRender method for a canvas which is added from Xaml.
KiranBabu M 11-Nov-11 2:26am View
   
"Regarding to ask a Question" will not sound a good subject.
Give specific subject to your question
KiranBabu M 10-Nov-11 8:14am View
   
null
KiranBabu M 10-Nov-11 5:29am View
   
sorry i am unable to find the index of the drop location item.
is there any other way to do it in WPF?
KiranBabu M 14-Oct-11 7:16am View
   
same image is saving but iam not able to save the edited image..
KiranBabu M 11-Oct-11 0:37am View
   
Media element is added in UI through Xaml.
KiranBabu M 11-Oct-11 0:36am View
   
Deleted
I have not copy pasted the real code, i just wrote two lines of code here whether to know in this way we can do it.
KiranBabu M 26-Sep-11 5:49am View
   
elegant solution...!
KiranBabu M 26-Sep-11 5:45am View
   
Thanks for the solution
KiranBabu M 30-Aug-11 7:17am View
   
good enough to understand..
thanks
KiranBabu M 26-Aug-11 8:13am View
   
Hi Rashim,

Your solution is not exactly want i wanted, but helped me to solve the problem.
But this is a different question u have posted the same answer of my previous question.i have already commented on ur answer over there.

Thanks,
KiranBabu M 26-Aug-11 3:31am View
   
not exactly,
but using this i solved the problem..

Cheers,
KiranBabu M 23-Aug-11 8:31am View
   
Thanks a lot Rashim..!
KiranBabu M 23-Aug-11 4:49am View
   
Hi Rashim uddin,
thanks for the reply.
Your example is good.
My question is on the wpf window(expression Blend) we can drag shapes like rectangle , ellipse after that we can change that shape in to control for eg:select rectangle then right click on it we have option Make in to control, so we can make that rectangle in to button control(now we can raise click event).
similarly at runtime, now i draw a rectangle shape with mouse(with Mousedown, mousemove, mouseup events) on the WPF window.
now if i click on this rectangle i cannot show any message, so i want to make this rectangle as a button.
Now how can we make this rectangle as a control from code behind..!
KiranBabu M 23-Aug-11 1:38am View
   
Deleted
What kind of editor it is..
can u be more specific..?
KiranBabu M 12-Aug-11 8:37am View
   
I have updated the question and what the error is
plz suggest me idea to accomplish it.
KiranBabu M 12-Aug-11 8:37am View
   
Hi Brown,
I have updated the question and what the error is
plz suggest me idea to accomplish it.
KiranBabu M 18-Jul-11 6:19am View
   
Deleted
.
KiranBabu M 18-Jul-11 6:18am View
   
Yes it is working..!
Your reply's really helped me a lot..
You are Super!!!

Thanks Again.
KiranBabu M 15-Jul-11 6:06am View
   
iam not able to clone the usercontrol.
In the above example MyUserControl content is fixed. similarly if i give MyuserControl content as static image like
Image img=new Image();
img.Height =125;img.Width=100;
BitmapImage src=new BitmapImage();
src.BeginInit ();
src.UriSource =new Uri(@"C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg");
src.EndInit();
img.Source =src;
now if i do drag and drop it is working.
But if i want to give imag path at runtime like

private void btnselect_Click(object sender, System.Windows.RoutedEventArgs e)
{
OpenFileDialog fd1=new OpenFileDialog ();
Nullable result = fd1.ShowDialog();
if (result == true)
{
UserControl uc=new UserControl();
uc.Height=125;uc.Width =100;
Label lb1 = new Label(); lb1.Height = 25;
lb1.Width = 85;
lbl.Content=fd1.SafeFileName;
Image img=new Image();
img.Height =125;img.Width=100;
BitmapImage src=new BitmapImage();
src.BeginInit ();
src.UriSource =new Uri(fd1 .FileName); src.EndInit();
img.Source =src;
StackPanel sp=new StackPanel(); sp.Children.Add(lb1); sp.Children .Add (img); uc.Content =sp;
uniformgrid1.Children.Add(uc);

if i click on a selectbutton and select image then only usercontrol must create along with that image. now there is no content in MyUserControl because i created usercontrol(with image content) in button click event.
so if i clone MyUsercontrol iam not able to give the same image path. and hence MyUserControl does not have any content to display.

I tried like this if i write the above code in MyuserControl, and
under button click:
MyUserControl cloned_uc = new MyUserControl();
now if do drag and drop, while dropping again openfiledaialog box is coming and if i select any image again the selected image is dropping in the canvas(irrespective of the dragged image).
This is the problem iam facing.

Thanks
KiranBabu M 14-Jul-11 9:30am View
   
Yes working Perfectly...
This is good.In your example you are Dynamically creating usercontrol and adding content in to it when window is loaded. But i want to create dynamic usercontrol(eg with image content) when we click on button which is on the window.image source will be selecetd through openfile dialog box.
eg:
private void btnselect_Click(object sender,System.Windows.RoutedEventArgs e)
{
OpenFileDialog fd1=new OpenFileDialog ();
Nullable<bool> result = fd1.ShowDialog();
if (result == true)
{
UserControl uc=new UserControl();
uc.Height=125;uc.Width =100;
Label lb1 = new Label();
lb1.Height = 25; lb1.Width = 85;
lbl.Content=fd1.SafeFileName;
Image img=new Image();
img.Height =125;img.Width=100;
BitmapImage src=new BitmapImage();
src.BeginInit ();
src.UriSource =new Uri(fd1 .FileName);
src.EndInit();
img.Source =src;
StackPanel sp=new StackPanel();
sp.Children.Add(lb1);
sp.Children .Add (img);
uc.Content =sp;
uniformgrid1.Children.Add(uc);
I tried to do this by replicating your example.
In your example usercontrol is created when window is loaded(we cant change data at runtime).
here Usercontrol and its content should be Dynamically created when we click on a button(we should change the content i.e, images at runtime by selecting through openfiledialogbox.).
I tried the whole day but not successful.
i want to create the instance of the data which is in button click.

Note:like when the window is loaded if i click on the button dialogbox will appear to select image, if i select image usercontrol should dynamically created with that image and name as content which should be displayed on the uniformgrid. now it should be copied to canvas by dragging and dropping.

Thanks


KiranBabu M 13-Jul-11 7:37am View
   
no it is not throwing any exception.
simply when i drag and drop the user control it is not dropping the user control in the drop location. but when i do drag and drop for removing the usercontrol from source and adding in drop location, it is working perfectly.
only when i want to copy the dynamic usercontrol by drag and drop in to the canvas it is not dropping.
when i debug, the newcontrol value is not null
newcontrol=system.windows.controls.usercontrol
but still it is not adding the newcontrol in drop location.

plz share me your view why it is not adding the dynamic usercontrol in drop location when i copy it and adding when i remove it from source.
give me any idea how to do this, plz
KiranBabu M 13-Jul-11 6:01am View
   
can u provide the xaml code of ur solution.
KiranBabu M 12-Jul-11 9:03am View
   
I have debugged the code, it is not creating the instance of dynamically created user control.

// in the drop event handler here it is not creating insatnce.
UserControl newcontrol;
newcontrol=Activator.CreateInstance(dragdropdata.UserControl
.GetType())as UserControl;
KiranBabu M 12-Jul-11 0:37am View
   
I have used the same code except that creating dynamic usercontrols with button ,label as content in to it and Mousemove event handler.
This is the code where it is going wrong, plz guide me the right way.

// Under button click event
UserControl uc=new UserControl();
uc.Height=125;uc.Width =100;
Button b1=new Button();
b1.Height =25;b1.Width=75;
b1.Content ="Dynamic button";
Label lb1=new Label();
lb1.Height=25; lb1.Width=85;
lb1.Content="Dynamic UserControl";
StackPanel sp=new StackPanel();
sp.Children .Add (b1);
sp.Children.Add(lb1);
uc .Content =sp;
uniformgrid1 .Children .Add (uc);
uc .MouseMove +=new MouseEventHandler(uc_MouseMove);

//Code for drag
private void uc_MouseMove(object sender, MouseEventArgs e)
{
UserControl dragableusercontrol=sender as UserControl;
if(dragableusercontrol!=null && e .LeftButton == MouseButtonState.Pressed )
{
DragDrop .DoDragDrop(dragableusercontrol ,new DropableCanvasDragDropData(dragableusercontrol .Parent as Panel , dragableusercontrol ,e.GetPosition (dragableusercontrol )),
DragDropEffects.Copy);
}
}
and for drop i have not changed the code, used the same DropableCanvas code.
KiranBabu M 11-Jul-11 14:02pm View
   
For Dynamically created user controls it is working if i use the code only when i drag and drop(i.e removing control from source).
if i tried to use the second sample for(copying source control but not remove) drag and drop, drop is not happening.
i have taken usercontrol content as button and label and tried to drag and drop(copy but not remove in source) it is not happening.
UserControl newcontrol;
newcontrol =
UserControl newcontrol;
Activator.CreateInstance(dragdropdata.UserControl.GetType()) as UserControl;
// here it is not creating instance.

Thanks
KiranBabu M 10-Jul-11 12:53pm View
   
By using the above code.
I have created user controls(with content) dynamically and mousemove event for that usercontrol from code. Now when i do drag and drop of these Dynamically created user controls, drag is happening but drop is not happening. usercontrols created from design mode and dynamically from code behaves differently(r they not same).

Can u guide me in the right way..

Thanks
KiranBabu M 8-Jul-11 1:52am View
   
Hi Tarun,
In the above code user control is dynamically created with image as content. Now i have added a event handler
u1.MouseMove +=new MouseEventHandler(uc_MouseMove);

private void uc_MouseMove(object sender, MouseEventArgs e)
{
Here iam unable to access the dynamically created user control object(u1);
}
how to get object name in event handler plz help me.
KiranBabu M 7-Jul-11 8:48am View
   
thanku.
now i understood clearly
KiranBabu M 7-Jul-11 8:47am View
   
thanks for the reply.
good point to notice.
KiranBabu M 7-Jul-11 8:46am View
   
Working perfectly..
Exactly wat i needed..
thanku..
KiranBabu M 6-Jul-11 9:43am View
   
Hi Mark Salsbery,
thats great..! both your solutions working perfectly.
thank u very much.
According to your solution we can able to drag and drop usercontrols between two canvases.
i just tried to remove this line
dragdropdata.SourcePanel.Children.Remove(dragdropdata.UserControl);
and changed Dragdropeffects.copy;
so that when we drag and drop it will copy the usercontrol to canvas(should not remove from source). its showing following error
" An exception of type System.invalidoperationException was thrown:\n Specified element is already the logical child of another element. Disconnect it first."
how can we drag and drop so that after drop usercontrol should be copied but not removed.

thanku once again
KiranBabu M 5-Jul-11 3:00am View
   
hello Mark Salsbery,

thanks for ypur reply,i tried your simple example but it is not working!!!
KiranBabu M 4-Jul-11 8:30am View
   
if u google perfectly u will get each and every question and answer..
KiranBabu M 30-Jun-11 5:22am View
   
Thanks tarun
i got it..
KiranBabu M 28-Jun-11 8:46am View
   
Hi,
thanks for ur reply
but i cant find any link related to drag and dropping videos..