|
I am new to wpf.
I have created a reflective textblock usercontrol .
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="LogoCreator.ReflectiveTextBlock"
Height="50" Width="189" mc:Ignorable="d">
<UserControl.Resources>
<VisualBrush x:Key="ReflectionBrush" Visual="{Binding ElementName=textBlock}"/>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock x:Name="textBlock" Grid.Row="0" Margin="0" FontSize="18.667" Text="Sample1" TextWrapping="Wrap" HorizontalAlignment="Left" Background="White"/>
<Rectangle x:Name="Reflection" Grid.Row="1" Margin="0,1,0,-32" RenderTransformOrigin="0.5,0.5" Fill="{DynamicResource ReflectionBrush}">
<Rectangle.OpacityMask>
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
<GradientStop Color="#7EFFFFFF" Offset="0"/>
<GradientStop Offset="0.5"/>
</LinearGradientBrush>
</Rectangle.OpacityMask>
<Rectangle.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="-1"/>
</TransformGroup>
</Rectangle.LayoutTransform>
</Rectangle>
</Grid>
</UserControl>
I have the rectangles fill property set to the textblocks visual brush.
The problem is when this control is add to the main window canvas, it shows only the text, the reflection is not shown.
Is it because the visualbrush resource is within the usercontrol ?
How do i solve it ?
|
|
|
|
|
Ive solved it by replacing the rectangle with border. And setting the borders background to visualbrush binded to textblock, without using resources.
I think the problem was that the visualbrush resource was within the usercontrol.
Thank you.
|
|
|
|
|
I am seeking help from the pros of WPF and 3D graphics to recommend books on the title mentioned that helped them. I did my search on Google but most examples assume you already know what the deal is (first time to try 3D in WPF).
Basically I have a 3D Model (plain) and a (Colored one or with texture). How to export it to something that WPF understands plus I want to use the mouse as the interacting device finally some properties the user can select and when a button is clicked the model change accordingly.
Is it also possible to convert the current camera view to an image and use it in Crystal reports?
Can I render many models at the same time (without showing it) and export the result to image and use it as a data source in crystal reports?
Can the user select the view of the camera view (via check box) before rendering the model (hidden) then use it in crystal report?
Suppose I have a cube, can I select a side from the cube and right click on it to get a menu similar to the menu when you right click on the desktop?
I am not asking for an implementation, only good references to help with the problem.
Thank you
|
|
|
|
|
I think Adam Nathan's WPF Unleashed[^] is one of the best on the market, with a good section on 3D.
[edit]Changed category to general[/edit].
|
|
|
|
|
Depending on what program your using for your 3d model, some programs will actually export the model as an xaml object. Makes life great .
|
|
|
|
|
All i want is to use MVVM pattern
I should use a form
example:
customer form which contains customer name and customer id
probably the application should use command when the save button is clicked
and add this data to the table in the database.
Can somebody send me how to do this.
I know how to do this with out the MVVM pattern
|
|
|
|
|
|
In addition to the article above, which is pretty much the MVVM standard, it seems, I would like to stress that you should take a long hard look at commands, templates and databinding before writing any code. Josh Smith's article uses commands in a different way from some others. This[^] article has IMO a nicer way of managing commands. Also, this[^] is a nice cheatsheet for WPF databinding.
|
|
|
|
|
I am looking for a small example in MVVM pattern.
I should be able to add data to the database and display data from the database
using MVVM pattern
If you have any thing like that send me or please post a link to it.
|
|
|
|
|
|
I have a simple UI I'm trying to write using the MVVM pattern:
Click a "browse" button, the OpenFileDialog should show up, let the user select a file, and then the "selected file" textbox should be filled with the selected file.
How do you do this simple thing in MVVM?
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|
|
Have a look at Onyx[^]. This has this functionality all built in for you.
"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
|
|
|
|
|
Awesome, thanks Pete.
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|
|
No probs mate.
"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
|
|
|
|
|
how I can creat or use a plotter(osciloscope) in my project(wpf)?
|
|
|
|
|
Please use a better title than Wpf - we know that this forum is WPF, and we don't need you to tell us that. Use the title to give us an indication of what your problem is, other than an inability to come up with a working title.
miralireza wrote: how I can creat or use a plotter(osciloscope) in my project(wpf)?
You're probably going to need the API for your Oscilloscope. This isn't a WPF specific question - it's more about how you interface with an external system. Your use of WPF is a secondary consideration.
"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
|
|
|
|
|
HI, This is a simple one, but i cant get it to work
I have a combobox filled with color names and a small colored rectangle next to the names.
I want to bind this combobox to a text box, such that when a color is selected in combobox, only the color name shows up in the text box. I need to do this programatically, not in xaml
My combobox datatemplate is
<DataTemplate x:Key="ColorText" >
<StackPanel Orientation="Horizontal">
<Rectangle Width="20" Height="28" Fill="{Binding Name}" Stroke="#FF000000"/>
<TextBlock Text ="{Binding Name}" />
</StackPanel>
</DataTemplate>
My current code to bind is
Binding myBinding = new Binding("Text");
myBinding.Source = this.colorTextBox;
myBinding.Mode = BindingMode.Default;
this.comboBox.SetBinding(ComboBox.SelectedItemProperty, myBinding);
But the result i get in text box is "System.Windows.Media.Color Blue" , i need only Blue to appear in the text box.
comboBox.selectedItem object contains 2 types, one is color and other is Name as the datatemplate shows.
Please help me to modify my above binding code , such that the text box shows only the name of the color and not "System.Windows.Media.Color Blue".
These controls(combobox and textbox) are programatically generated.
|
|
|
|
|
Use a converter.
Create a class that implements IValueConverter, and in the Convert() function, change it from "System.Windows.Media.Color.Blue" to "Blue" with some simple string parsing. Then just set it as the Converter property of the binding.
Your code is a bit confusing, though... You're binding the selected item to a textbox? Does the Name property contain an actual color object, or a name of a color? Something doesn't seem quite right.
|
|
|
|
|
The name property contains only a string eg. "Blue"
The comboBox is filled with colors from Colors list.
Helper h=new Helper();
this.comboBox.ItemsSource =h.GetPropNames(typeof(Colors));
The first property is a color and second one is Name, hence the full string looks like this "System.Windows.Media.Color.Blue Blue". I want to bind the comboBox.selectedItem.Name to the textbox, so the textbox shows only "Blue"
I used value converters and it works , Thank you
|
|
|
|
|
Dear Friends,
See I want to Clear My IsolateStorage once the Browser is Closed In Silverlight.
I Have I Tried with Evry Javascript Posssible.I Dont Wnat to Clear my Isolated
Storage When Browser is Refreshed.So How Should I Detech Browser Closed
And Refres.
Thanks in Advance.
Regards,
Muneer.
Muneer
|
|
|
|
|
How can we capture the Keypress event and the pressed key, on a WPF toolkit datagrid? I need to capture the F9 key, when the user is focussed on a particular column.
Plus, can anybody suggest a good site to study the WPF toolkit datagrid? The basic CRUD operations need to be implemented. I am totally new to .NET 3.5.
Thanks Folks!!!
|
|
|
|
|
I'm having a similar problem; I need to implement a double-click on the datagrid, while using MVVM. So I don't want to have any event handling code in the code-behind. Preferably binding to a command property in the VM.
I've searched the internet all ower and still cannot find a suitable solution. Is there somehow a way (for me and sameercodes) to handle these keyboard and mouse events with behaviours or gestures AND bind to a command
Thanks. 
|
|
|
|
|
To learn about DataGrid, I suggest looking at "WPF DataGrid Practical Examples" [^]. To respond to the F9 key I expect you can use the KeyDown event, but I have not tried this.
To handle such events in a MVVM pattern - that is tricky and not something I have solved. So far I have taken the easy path and simply used codebehind. I suspect the answer might be in "WPF : If Heineken did MVVM Frameworks Part 2 of n" [^] - View Lifecycle Events - but I have not yet properly followed this or tried it.
I hope that might be helpful.
Tim
|
|
|
|
|
Hi,
I have a WPF custom control. Its a container control derived from system.Windows.controls.Grid.
My requirement is only one control should be there in a cell of Grid.
I want to delete a control say Button, when the user drags & drops it on my custom control's cell & that cell already contains a control in it. I want to delete the control automatically & also the XAML should be updated for the same(XAML entry for the control should also be removed).
Currently what I am doing is in my Custom container's ArrangeOverride Method(), I am deleting the child control but the XAML is not updated for the same. I mean when the control is dragged on a cell with already having a control, control doen't appear in UI(as the code in ArrangeOverride deletes it from child collection ) but the XAML entry for the control is still present in xaml.
should I use any AdonerProvider or TaskProvider fotr this. If so how?
Thanks in Advance,
Vinod C S
modified on Thursday, October 22, 2009 5:18 AM
|
|
|
|
|
I have posted the following question on codeplex, but not had any reply. I am hoping someone here may be able to help.
I have a WPF DataGrid which represents a small number of options (ie one option per row), one of which is chosen as the default. In the first column of the DataGrid I want to have a RadioButton in each row - to set the default. I have almost got this to work with the code below - the Binding is working. The problem is, it is possible to get into a scenario where the setting from the RadioButton is lost.
Our underlying object being bound to implements IEditableObject and we use this in various way to check edits and also take action when the default is changed. I have found that clicking the RadioButton completely bypasses the BeginEdit / EndEdit process of the DataGrid.
The xaml is as follows:
<toolkit:DataGrid Name="dgTesters" AutoGenerateColumns="False" AlternationCount="2" ItemsSource="{Binding LocalTesters}"
CanUserAddRows="false" CanUserDeleteRows="False"
SelectionMode="Single"
RowEditEnding="dgTesters_RowEditEnding">
<toolkit:DataGrid.Columns>
<toolkit:DataGridTemplateColumn>
<toolkit:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate >
<RadioButton IsChecked="{Binding Path=IsDefault, Mode=TwoWay}" GroupName="a" />
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellEditingTemplate>
<toolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<RadioButton IsChecked="{Binding Path=IsDefault, Mode=TwoWay}" GroupName="a" />
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellTemplate>
</toolkit:DataGridTemplateColumn>
<toolkit:DataGridTextColumn Binding="{Binding TesterName}" Header="Tester Name" Width="*" MinWidth="80" />
<!-- Further columns deleted -->
</toolkit:DataGrid.Columns>
</toolkit:DataGrid>
I think what is happening is that the CellTemplate is handling the RadioButton click, so the CellEditingTemplate never gets to fire BeginEdit... Does that make sense?
If I remove the DataGridTemplateColumn.CellTemplate, I can see the BeginEdit / EndEdit being fired.
This is also being used in a MVVM pattern, so I wanted to avoid handling mouseclicks.
It seems using a RadioButton in this way would be a fairly common requirement - I must be missing something. Can anyone point me in the right direction?
Thanks, Tim
|
|
|
|