|
I want to create datetime, time and duration control...
I have created the datecontrol by using datepicker available in Silverlight....
Do we have any existing controls available in Silverlight 2.0 so that I can make datetime, time and duration controls...?
Or have to extend some controls to get above controls?
Can anybody have some code / hyperlinks from where I can get the idea?
|
|
|
|
|
How to write a type-ahead (suggests) control in WPF.
thanks
Ganesh
|
|
|
|
|
|
I have ListBox in test.xaml:
<grid>
<listbox margin="12,28,0,0" name="ListBox1" horizontalalignment="Left" width="77" height="100" verticalalignment="Top">;
;
And in the test.xaml.cs file, I initialized the ListBox as
for (int i=1; i<=50; i++)
{
ListBox1.Items.Add("Item" + i);
}
Now I want to set a "HelpText" AutomationProperty to each of the ListItems. How do I do it?
I heard it could be done through Binding? Can some one provide me the required info?
Thanks.
|
|
|
|
|
[Reposting; Some problem in text display]
I have a test.xaml:
<Grid>
<ListBox Margin="12,28,0,0" Name="ListBox1" HorizontalAlignment="Left" Width="77" Height="100" VerticalAlignment="Top" />;
</Grid>;
And in the test.xaml.cs file, I initiatilize the ListBox
for (int i=1; i<=50; i++)
{
ListBox1.Items.Add("Item" + i);
}
Now I want to set a HelpText AutomationProperty to each of the ListItems. i.e. HelpText1 to Item1, HelpText2 to Item2 and likewise. How do I exactly do it?
Thanks
|
|
|
|
|
Hello..
I want some help from you guys in my wpf project.
I prepared my project using MVVM pattern.
I am using HeaderedContentControl and in content presenter of that i am using tab control.
MyControl.xaml
<Window.Resources>
<Style x:Key="HeaderStyle" TargetType="{x:Type HeaderedContentControl}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Border BorderBrush="LightGray" BorderThickness="1" CornerRadius="5" Margin="4" Padding="4" SnapsToDevicePixels="True">
<TextBlock FontSize="14" FontWeight="Bold" Foreground="White" HorizontalAlignment="Center" Text="{TemplateBinding Content}" />
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type HeaderedContentControl}">
<DockPanel>
<ContentPresenter
DockPanel.Dock="Top"
ContentSource="Header"
ContentTemplate="{TemplateBinding HeaderTemplate}"
/>
<ContentPresenter
ContentSource="Content"
ContentTemplate="{TemplateBinding ContentTemplate}"
/>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="MyWorkingTemplate">
<TabControl
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource ClosableTabItemTemplate}"
Margin="4"
/>
</DataTemplate>
</Window.Resources>
<HeaderedContentControl
Content="{Binding Path=Workspaces}"
ContentTemplate="{StaticResource MyWorkingTemplate}"
Header="My Tabs"
Style="{StaticResource HeaderStyle}"
/>
In Content template my all bindings working fine with viewmodel..But my problem is,in my header template here i have textblock and now i want here some content control and binding two different views here and show it according to requirement..
Any help??
|
|
|
|
|
|
|
Hi,
I have a word file. I want to save the first page as a picture. How can I do it using C# code?
Thanks,
Prajeesh
|
|
|
|
|
Please pick a more appropriate forum.
"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
|
|
|
|
|
i have a RadialGradiantBrush in the app.xaml
<Application.Resources>
<RadialGradientBrush x:Name="RGB1">
<GradientStop Color="AntiqueWhite" Offset="0.0" />
<GradientStop Color="LightSalmon" Offset="0.25" />
<GradientStop Color="LightBlue" Offset="0.75" />
<GradientStop Color="Wheat" Offset="1.0" />
</RadialGradientBrush>
</Application.Resources>
I assign it to a background in the generic.xaml
<Canvas x:Name="RightCanvas" Grid.Column="2" Background = "{StaticResource RGB1}"/>
How can i do this in the .cs file
RightCanvas.Background = "{StaticResource RGB1}" as RadialGradiantBrush
?
Thank you .
|
|
|
|
|
RightCanvas.Background = Application.Current.Resources["RGB1"] as RadialGradientBrush;
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks
Great, I have my brushes in app.xaml
and now can access them from xaml or cs !
But now the designer doesnt work
Error HRESULT E_FAIL has been returned from a call to a COM component.
vs2008
|
|
|
|
|
daveyerwin wrote: But now the designer doesnt work
Since the Silverlight XAML designer is only partially implemented in VS,
it can be "challenging" to find the offending code or markup
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi.
I have a big image ( like a map ).
I wanna show it in an image (in WPF) as when user do MouseDown on it , it can move map coordinates .
Something like Google map.
Could you guide me how I can do it ?
Thanks
|
|
|
|
|
A popular way to deal with images that are too large to fit all at once
into a practical amount RAM and/or transferred across a network in a reasonable
amount of time is to deal with the image in parts, or "tiles".
Displaying a single tile is relatively easy...handling mouse events is relatively easy...
Designing a system to work with tiles and keep track of them is the majority of the
work.
What kind of guidance are you looking for? Do you have a more specific part of the given
problem that you are struggling with?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark .
Mark Salsbery wrote: Displaying a single tile is relatively easy...handling mouse events is relatively easy...
I'm green in these subjects (tiles and move image with mouse events).
Could you post a references about them ?
|
|
|
|
|
Mohammad Dayyan wrote: I'm green in these subjects (tiles and move image with mouse events).
By "tile", I mean a rectangular (usually) portion of a larger image.
For example, I work with large images (larger than 20000 pixel dimensions) divided
into tiles 256x256 and/or 512x512 pixels.
How you load, cache, and render the tiles depends on your requirements.
Maybe start with the fundamentals:
WPF Fundamentals[^]
Input Overview[^]
WPF: Images[^]
Of course, if your entire image fits in memory, you could simply use an Image control
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am creating a chat program in WPF based on the one I made in WinForms,
to give it an edge and a cool new look.
As part of the program, when the user logs in, it displays a custom
welcome message with the user's name in it. I used the 'modified' tag in
VB WinForms to do this.
The code I am using for this operation is:
Dim name As String = ""
If TextBox1.Modified Then
name &= TextBox1.Text
End If
If name <> "" Then
Label3.Text = ("Welcome " & name)
MsgBox("Welcome " & name)
End If
I am wondering if anyone
knows what the equivalent is in WPF as I have no idea. I would also like to know if you
can put a WebBrowser control on a form in WPF. Any responses would be
greatly appreciated.
Dloog!
|
|
|
|
|
What you could do (and I'd recommend this) is use two way databinding. That way, you don't have to write code to check for modified flags or the like. First of all, you should write a class that implements the interface INotifyPropertyChanged like so:
public class Login : INotifyPropertyChanged
{
private string _name;
public string Name
{
get { return _name; }
set
{
if (_name != value)
{
_name = value;
Changed("Name");
}
}
public event PropertyChangedEventHandler;
protected virtual void Changed(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
} Then, in your XAML, you'd bind the textbox and the label to the same property
:<TextBox Text="{Binding Path=Name, Mode=TwoWay}" MaxLength="10" />
<Label Text="{Binding Path=Name, Mode=TwoWay}" /> Bind this object to the datacontext of your window, using this.DataContext = new Login(); in the window class (you may want to do this immediately after you the call to InitializeComponent(); . Now, when you change a value in the textbox, the label updates automatically.
"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
|
|
|
|
|
One could still go wild with an attached behaviour in order to mimic the WinForms functionality, but with WPF, it really isn't necessary anymore. But you gotta love the flexibility of the platform
btw: Subscribed to your blog lately and noticed that your blog is missing a visible feed link (unless it's really well hidden).
Cheers,
Philipp
NetDrives - Open Source Network Share Management
|
|
|
|
|
Philipp Sumi wrote: btw: Subscribed to your blog lately and noticed that your blog is missing a visible feed link (unless it's really well hidden).
Oops. I'll have to sort that out.
Philipp Sumi wrote: But you gotta love the flexibility of the platform
Damn straight. Attached functionality is one of the reasons that the Tag property is no longer necessary.
"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
|
|
|
|
|
Sorted - take a look under the Meta link. I've moved it to the top from the bottom of the sidebar.
"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
|
|
|
|
|
It was there the whole time, wasn't it? It's surprising how the brain even filters information ("do not interpret entries in the meta section because there's the admin stuff") even if you don't want it to. I honestly never noticed that there's an additional feed link although my blog runs on WP, too
In case I'm not the only one with that particular problem - an RSS link in the top area along with a shiny orangy RSS icon might help to get you some additional readers. Maybe not the brightest ones
Cheers,
Philipp
NetDrives - Open Source Network Share Management
|
|
|
|
|
Ah - the joy of WordPress - especially with their default templates. I've been trying to find out how to add RSS feed links to the site and haven't been having too much luck with it.
"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
|
|
|
|