|
Hello.
I'm working with Expression Blend 2.
SomeTimes I see d:LayoutOverrides="Height" or d:LayoutOverrides="Width" in the XAML code.
What's that?
What dose it do ?
|
|
|
|
|
See here[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, I would like to know if I can use the slider control properties to create a knob control in XMAL and how to code it.
|
|
|
|
|
|
|
Jammer,
I'll check this out. Thanks for the heads up!
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi,
I have a MultidataTrigger Condition style thats been implemented to a TextBox [1]. I also have another style which I require to implement on the NameTextBox. How do we implement multiple styles on a Text Box?
[1]
<TextBox x:Name="NameTextBox" Style="{StaticResource requiredFieldValidationTextBoxStyle}" Text="{Binding Path=Name}" Width="100"/>
Regards,
Vipul Mehta
|
|
|
|
|
You can't as far as I know.
|
|
|
|
|
You have to create a new style - you could always have this style BasedOn the initial style, and then implement the bits you need on top.
|
|
|
|
|
Pete is correct here.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
That's not really using two styles on a control though is it? It's just basing one style on another style as far as I can tell.
|
|
|
|
|
True - that's why I said you had to create a new style. There's no way round this as you noted earlier.
|
|
|
|
|
|
And to clarify the point, I 5d your answer above. That should make it plain for the OP.
|
|
|
|
|
I've not actually used the BasedOn approach to a styles yet. Could prove interesting to see how it actually works.
|
|
|
|
|
I use it a lot - it's incredibly useful.
|
|
|
|
|
Hello,
I am still having a trouble cropping with my project I am trying to create, which I have included the code and the XAML code below. For my project, i am trying to have the user click on the button "crop image" then they are given the ability to highlight the area to crop, and right click and save the crop image as jpg or bmp, so far i have looked at several examples including jim's input (thank you jim again) but still is a little confusing to me, if someone can help me out with this by completing the missing piece (or finishing the project), and/or explain that would be great. I am willing to go even as far as talking over the phone or email just to help me because i feel this is an essential thing to learn using WPF/C# image object/bitmap. If anyone can help me out with this one i would be very very grateful. So again, the code is below so you can see what i got so far, which i like because you can zoom in and out of the image object called viewerphoto1 using the slider. Anyways here is the code below:
XAML:
<Window x:Class="WPFcropimage.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="370" Width="591">
<Grid Height="341" Width="595">
<DockPanel Margin="23,33,181,29">
<Slider x:Name="Zoom" DockPanel.Dock="Left" Value="1" Minimum="0.1" Maximum="5" Width="25" Orientation="Vertical" ValueChanged="Zoom_ValueChanged" />
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Height="270" Width="356">
<Image Stretch="Uniform" Height="262" Width="349" Name="_viewedPhoto1">
<Image.LayoutTransform>
<ScaleTransform ScaleX="{Binding ElementName=Zoom,Path=Value}" ScaleY="{Binding ElementName=Zoom,Path=Value}"/>
</Image.LayoutTransform>
</Image>
</ScrollViewer>
</DockPanel>
<Button Height="38" HorizontalAlignment="Right" Margin="0,33,41,0" Name="_btnbrowse" VerticalAlignment="Top" Width="104" Click="_btnbrowse_Click">Browse for Picture</Button>
<Button Height="38" HorizontalAlignment="Right" Margin="0,89,41,0" Name="_btnCrop" VerticalAlignment="Top" Width="104" Click="_btnCrop_Click">Crop Picture</Button>
<Button Height="37" HorizontalAlignment="Right" Margin="0,0,41,33.5" Name="_btnClose" VerticalAlignment="Bottom" Width="104" Click="_btnClose_Click">Close</Button>
<Border Margin="53,37.5,187,33.5" Name="_border1" BorderBrush="Black" BorderThickness="2">
</Border>
</Grid>
</Window>
C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing;
namespace WPFcropimage
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void _btnbrowse_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.InitialDirectory ="c:\\";
dlg.Filter =
"Image files (*.jpg)|*.jpg|*.bmp)|*.bmp|All Files (*.*)|*.*";
dlg.RestoreDirectory =
true;
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string selectedFileName = dlg.FileName;
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource =
new Uri(selectedFileName);
bitmap.EndInit();
_viewedPhoto1.Source = bitmap;
}
}
private void _btnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void Zoom_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
}
private void _btnCrop_Click(object sender, RoutedEventArgs e)
{
}
}
}
|
|
|
|
|
Hey everyone,
I was looking at this example from the link below, which i like, i am trying to have the user click on the button crop image, and thats when it will show the rectangle, however the description or the explanation is sorta hard to understand, can anyone help me with this, including how to get crop image to appear on the crop image viewer object?
thanks
link:
http://www.codeproject.com/KB/WPF/CropAdorner.aspx[^]
|
|
|
|
|
Using VS2008 Standard on XP/64:
I'm trying to do my first WPF app, and the IDE seems to have lost the ability to show properties for any control. The only way to fix it is to shut the IDE down and restart it, and then, it only works for the first control you try to view the properties for. What a POS...
"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
|
|
|
|
|
Wait, you were using the IDE? That's your problem, everybody knows that you shouldn't use XAML never mind the IDE, just use C#.
|
|
|
|
|
Did I miss something? Is there question here or just a rant?
only two letters away from being an asset
|
|
|
|
|
Looks like soapbox material to me!
Or maybe the MS complaint department redirects to here...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I created a UserControl in XAML that includes a Frame. But when the application is loading the Frame source, the application throws and InvalidOperationException. This message tells me, that the class for the Frame's source couldn't be found in the given namespace. And this is true, because it doesn't use the namespace I intended. Here's a short example to illustrate the problem:
<UserControl
x:Class="foo.fooControl"
...>
<Frame Source="fooPage.xaml" />
</UserControl>
<Page
x:Class="foo.fooPage"
...>
...
</Page>
Now the application tries to find the class for fooPage in the wrong namespace, i.e. foo.fooControl.fooPage. But that's of course wrong, because it's called foo.fooPage.
Can anybody help me and show me the correct way to achieve what I want?
Thanks in advance,
Jammni+
|
|
|
|
|
Are you sure you didn't change the namespace in your code-behind?
This works fine for me:
<!-- UserControl1.xaml -->
<UserControl x:Class="WPFTester.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="128" Width="200">
<Grid>
<Frame Name="frame1" Source="Page1.xaml" />
</Grid>
</UserControl>
<!-- Page1.xaml -->
<Page x:Class="WPFTester.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Page1" Height="128" Width="200">
<Grid Background="SteelBlue"/>
</Page>
<!-- Window1.xaml -->
<Window x:Class="WPFTester.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFTester"
Title="Window1" Height="300" Width="300">
<Grid>
<local:UserControl1></local:UserControl1>
</Grid>
</Window>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your answer. That's more or less exactly what I am doing. Only that I placed the files in some directories, so the namespace is a bit longer.
And I didn't change the namespace in the code behind files. The strange thing is, that the exception already says, that the class should be located in a different namespace - one, that doesn't make any sense to me.
Currently I load the page in the code behind file. Perhaps I get some time later this day and can break it down and post a "working" sample.
But anyway, thanks for your answer
|
|
|
|