|
Mohammed Hameed wrote: lot of unused usings being created in this files Right click on any of the using statements and select "Organize Usings" -> "Remove Unused Usings".
Use the best guess
|
|
|
|
|
But that is a auto-generated file, if we manually remove the usings then it will again recreate when we rebuild the project. Therefore I need a permanent fix, something like as suggested by Pete to edit the template but unfortunately I'm unable to find that template.
http://authenticcode.com
|
|
|
|
|
If it's an auto generated file then you should not be modifying it in the first place. Also, why does it matter, as these statements are only used by the compiler?
Use the best guess
|
|
|
|
|
Some of them are required for starting the app, intellisense, assembly identification etc.
Take a look at the App.g.cs (for a desktop wpf app). It loads the BAML (compiled XAML, embedded as a resource in the assembly) to the XAML parser. Without it probably your WPF application will not run. They just contain few lines of code so not a thing of worry as they aren't huge memory/cycle eating hogs!
Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas.
Source
|
|
|
|
|
Thank you Amitosh. Now I got the clear idea and thanks for mentioning BAML.
http://authenticcode.com
|
|
|
|
|
Hi,
I writing an app with Wpf, MVMM, Prism and Entity Framework, I have a conflict for using entity framework.
Which one is better? Code First or Database First?
Also :
- The database is existing.
- I want just save a single entity (with AutoDetectedChangedEnable)
- Working with Observable Collection in binding.
Thanks a lot
Hossein
|
|
|
|
|
Hossein Khalaj wrote: The database is existing
I would think that makes you question irrelevant for this project!
Personally I can't conceive of a code first project, it is all about the database, but then I'm purely a LOB developer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I used multiple silverlight project in my solution based on microsoft prism framework. my application is very slow and consume over 200m of memory. what to do?
|
|
|
|
|
Profile it to find out what's getting called repeatedly and unecessarily, or what is being loaded when it doesn't need to be. There are many suitable profilers you could use.
|
|
|
|
|
i wanna to get audio buffer to mediaelement. when playing wmv file in mediaelement.
|
|
|
|
|
Hi,
I have a requirement, where i need to draw line dynamically with the help of mouse using WPF. Finally i need to capture X-Axis & Y-Axis measurement once a curve line drawn, how to do that?
|
|
|
|
|
Have you looked around on htis site for projects, as there are many articles on the subject.
HEres one
WPF DrawTools[^]
|
|
|
|
|
Im using MVVM. I have a form and a grid view below the form. Once I save data in GridView, it goes to database and show in GridView. I want to load data to the controls when select a particular row in GridView.
This is my GridView in View
<ListView SelectedValue="_row" ItemsSource="{Binding PromExams}" Name="ListViewEmployeeDetails" Margin="13,159,38,0" Height="183" VerticalAlignment="Top" >
<ListView.View>
<GridView x:Name="grdTest" >
<GridViewColumn Header="Part 1 Marks" DisplayMemberBinding="{Binding Part1Marks}" Width="100"/>
<GridViewColumn Header="Part 2 Marks" DisplayMemberBinding="{Binding Part2Marks}" Width="100"/>
<GridViewColumn Header="Total" DisplayMemberBinding="{Binding Total}" Width="100"/>
<GridViewColumn Header="Average" DisplayMemberBinding="{Binding Average}" Width="100"/>
</GridView>
</ListView.View>
</ListView>
how can I do that
|
|
|
|
|
i want to implement audio bars in mediaelemnt ...
|
|
|
|
|
I dont understand, could you expalain or elaborate?
|
|
|
|
|
I am trying to create a reasonably complex datagrid.
At the core, there are sting pairs where the first string is the key and the second is the value.
I make 2 passes through the base array. Don't try to understand the base array, just accept that 2 strings, key and value, are extracted.
On the first pass, the datagrid has columns dynamically created. The column names works as expected. I believe the binding is not correct.
Once all know possible columns are known, the second pass extracts the key/value pairs from the original table and composes a dictionary called "person".
The original table is a 2 dimensional table, first an array of key/values of dynamic length then a dynamic number of such arrays.
Each dictionary is added to a List called "persons"
If a particular key is not found in the base table, the value "_" is assigned.
Finally the datagrid.itemsource is assigned the list "persons".
When the datagrid is displayed, the column names are correct.
The number of columns is correct.
The number of rows is correct but blank.
The debugger output window shows a flurry of error messages such as:
==========
System.Windows.Data Error: BindingExpression path error: 'mv' property not found on 'System.Dynamic.ExpandoObject' 'System.Dynamic.ExpandoObject' (HashCode=60469192). BindingExpression: Path='mv' DataItem='System.Dynamic.ExpandoObject' (HashCode=60469192); target element is 'System.Windows.Controls.TextBlock' (Name=''); target property is 'Text' (type 'System.String')...
======
Note that "mv" is one of the column names.
When I display the "persons" list using the debugger dynamicview for "persons" it does show the column name "mv" with the correct value.
The xaml:
===
<controls:ChildWindow x:Class="VCI_Envision_Portal.Views.LegacyGraphicDisplay.BackgroundDataxaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
Width="400" Height="300"
Title="BackgroundDataxaml"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
>
<Grid x:Name="LayoutRoot" Margin="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
<data:DataGrid AutoGenerateColumns="True" Height="226" HorizontalAlignment="Left" Name="BackgroundDataGrid" VerticalAlignment="Top" Width="372" />
</Grid>
</controls:ChildWindow>
===
the xaml.cs:
====
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections;
using System.Collections.ObjectModel;
using System.Windows.Data;
using System.Dynamic;
using Microsoft.CSharp;
using Microsoft.CSharp.RuntimeBinder;
using VCI_Envision_Portal.VCIWCFServicesNS;
namespace VCI_Envision_Portal.Views.LegacyGraphicDisplay
{
public partial class BackgroundDataxaml : ChildWindow
{
private ObservableCollection<VCI_Point_Data[]> vci_pt_data_cooked_bg = new ObservableCollection<VCI_Point_Data[]>();
List< ExpandoObject > persons;
public BackgroundDataxaml(VCI_Point_Data[][] vci_pt_data_cooked_in)
{
int i;
for (i = 0; i < vci_pt_data_cooked_in.Length; i++)
{
vci_pt_data_cooked_bg.Add(vci_pt_data_cooked_in[i]);
}
InitializeComponent();
SetPageValues();
}
private void SetPageValues()
{
int index = 0;
RowDefinition rd = new RowDefinition();
persons = new List<ExpandoObject>();
ObservableCollection<Customer> bdd = new ObservableCollection<Customer>();
int iCount = vci_pt_data_cooked_bg.Count();
while (index < iCount)
{
int iColumnCount = 0;
DataGridRow dgr = new DataGridRow();
if (vci_pt_data_cooked_bg[index] != null)
{
int iColumns = vci_pt_data_cooked_bg[index].Count();
while (iColumnCount < iColumns)
{
if (vci_pt_data_cooked_bg[index][iColumnCount] != null)
{
Customer bob = new Customer();
bob.FieldName = vci_pt_data_cooked_bg[index][iColumnCount].Pt_Column;
bob.FieldValue = vci_pt_data_cooked_bg[index][iColumnCount].Pt_Value;
bdd.Add(bob);
{
int i = 0;
bool bFound = false;
for (i = 0; (i < BackgroundDataGrid.Columns.Count) && !bFound; i++)
{
if (BackgroundDataGrid.Columns[i].Header.Equals(bob.FieldName))
bFound = true;
}
if (!bFound)
{
DataGridTextColumn mycol = new DataGridTextColumn
{
Header = bob.FieldName,
Binding = new Binding( bob.FieldName )
};
BackgroundDataGrid.Columns.Add( mycol );
}
}
}
iColumnCount++;
}
}
index++;
}
iCount = vci_pt_data_cooked_bg.Count();
ObservableCollection<DataGridColumn> dgc = BackgroundDataGrid.Columns;
index = 0;
while (index < iCount)
{
int iCols = 0;
var aperson = new ExpandoObject() as IDictionary<string, Object>;
while (iCols < dgc.Count())
{
bool bFound = false;
int y = 0;
string skey = dgc[iCols].Header.ToString();
if ( vci_pt_data_cooked_bg[index] != null )
{
while ( (y < vci_pt_data_cooked_bg[index].Length) && !bFound )
{
if (vci_pt_data_cooked_bg[index][y].Pt_Column.Equals(skey ) )
{
bFound = true;
aperson.Add( skey, vci_pt_data_cooked_bg[index][y].Pt_Value );
}
y++;
}
if (!bFound)
{
aperson.Add(skey, "_");
}
}
iCols++;
}
index++;
persons.Add((ExpandoObject)aperson);
}
BackgroundDataGrid.ItemsSource = persons;
}
private void OKButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
}
public class Customer
{
public string FieldName { get; set; }
public string FieldValue { get; set; }
}
}
}
===
I think the binding is wrong.
But this is the best I could decipher from online examples.
Please advise.
Boyd
Boyd D. Mills
mailto:BMills@VCIControls.ca
|
|
|
|
|
I have a WPF project and I have added a user control but when I try to add the xmlns of the user control to the MainWindow xaml, nothing shows up in the intellisense what am I missing here. Thanks.
|
|
|
|
|
I think I found a solution to this. I just selected the first namespace that had the same name as my project. My project name is ParametricModeler. So I typed:
xmlns:local="" and selected the option ParametricModeler(ParametricModeler). So that I have
xmlns:local="clr-namespace:ParametricModeler" That let me add the user control I made to the MainWindow.
<Grid>
...
<local:Calculator/>
</Grid>
I was working from a youtube video: [^]
But this is not the way xmlns namespace was selected in the example video. The name of the UserControl was added to the namespace options list after the project was rebuilt. But I could not get that option and I tried several times with different projects. He was using a different version of Visual Studio would that mater? Did I do good? I am using VS 2012.
Also how do you add a property to a user control if you are coding in Visual Basic?
|
|
|
|
|
tomr1 wrote: xmlns:local="clr-namespace:ParametricModeler"
You need to add a local reference to your class / dll.
So this is indeed correct.
|
|
|
|
|
Thanks Abhinav S. I have a kind of related question about how to get access to the MainWindow resources from the UserControl. I have the MainWindow code:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ParametricModeler"
...>
<Window.Resources>
...
</Window.Resources>
</Window>
Then in the UserControl I do not know how to access those resources. For instance I have a Gradient Brush that I am trying to apply to the control but its key is not recognized:
<UserControl x:Class="Calculator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
...>
<Grid x:Name="CalculatorControl">
<Rectangle Fill="{StaticResource ButtonBrush}" RadiusX="10" RadiusY="10"/>
...
</Grid>
</UserControl>
The error reads, "The resource "ButtonBrush" could not be resolved".
|
|
|
|
|
The reason the UserControl can't access the gradient brush is because it's a Window resource. If it was a userControl resource, <UserControl.Resources> , then you wouldn't be getting the error. Alternatively you could place the gradient brush in a ResourceDictionary .
"As beings of finite lifespan, our contributions to the sum of human knowledge is one of the greatest endeavors we can undertake and one of the defining characteristics of humanity itself"
|
|
|
|
|
i am looking for windowmedia format sdk that works with silverlight.
|
|
|
|
|
I have a WPF project where I have a main grid and inside that I have some basic 3D elements for basic 3D modeling of points in time(like a 3D grapher). I am using a seperate library for the 3D stuff. I added basic tools like a calculator and a timer control and other controls. These controls consist of a grid and inside that grid is a rectangle control and some textboxes and buttons. I do not know how to make the grids be dragable like a regular window. Is there a simple method for this?
I am using Visual Studio Express Edition 2012. I program in Visual Basic. Thanks for your help.
modified 25-Jun-13 23:51pm.
|
|
|
|
|
Canvas would allow your costume grid to be drag-able.
To add Grid on to Canvas :
var canvas = new Canvas();
var grid = new YourCustomeGrid();
canvas.Children.Add(grid);
To set grid position on the canvas :
grid.SetValue(Canvas.TopProperty, 20.0);
grid.SetValue(Canvas.LeftProperty, 20.0);
Then you just have to Add Eventhandler for your control to change the position when your drag your mouse.
|
|
|
|
|
Thanks for the reply sorawit amorn. Sorry about the delay.
So I made a new project to focus on just this dragging issue. I am not great with C# but I get most of what you have there. I declared a canvas and a grid inside that canvas in the xaml code of the main window. In the behind VB code I created a loaded event handler with the initial grid positions.
Here is the Main Window code:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Canvas x:Name="ControlCanvas" Background="AliceBlue" >
<Grid x:Name="ControlGrid" Width="100" Height="40">
<Rectangle Fill="Black"/>
</Grid>
</Canvas>
</Grid>
</Window>
And here is the MainWindow.xaml.vb code:
Class MainWindow
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
ControlGrid.SetValue(Canvas.TopProperty, 20.0)
ControlGrid.SetValue(Canvas.LeftProperty, 20.0)
End Sub
Private Sub MainWindow_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs) Handles Me.MouseLeftButtonDown
End Sub
End Class
I have no idea how to write in code what I need to do next. I need a conditional statement for when the mouse is over the grid control. Then I need to get the position of the cursor and somehow update the position of the control simultaneously. How do I do that? Thanks again.
|
|
|
|